I am working on Word , Excel and PowerPoint add-ins . I want to upload document from graphs API .Below are API PUT https://graph.microsoft.com/v1.0/users/**myuser@domain.subdomain.com**/drive/items/root:/filename.docx:/content and it is working fine from Postman .
My concern how I will get USER Mail Id from Word , Excel and PowerPoint add-ins as Any direct API not available .
I follow below article still not success and getting 13006 error .
message: "An unexpected error occurred in the client." name: "Error occurred in the authentication request from Office."
https://docs.microsoft.com/en-us/office/dev/add-ins/develop/register-sso-add-in-aad-v2
async getToken() {
var returnObject;
window.Office.context.auth.getAccessTokenAsync({ allowConsentPrompt: true, allowSignInPrompt: true },function (result) {
console.log( result);
if (result.status === "succeeded") {
var token = result.value;
returnObject = token;
console.log(token)
} else {
console.log("Error obtaining token", result);
}
});
return returnObject;
}