我正在尝试从Outlook Web Addin实现呼叫OneDrive Api。
我使用下面的代码获取访问令牌。
function initializePane() {
// First attempt to get an SSO token
if (Office.context.auth !== undefined && Office.context.auth.getAccessTokenAsync !== undefined) {
Office.context.auth.getAccessTokenAsync(function (result) {
if (result.status === "succeeded") {
// No need to prompt user, use this token to call Web API
saveAttachmentsWithSSO(result.value, 1);
} else if (result.error.code == 13007 || result.error.code == 13005) {
// These error codes indicate that we need to prompt for consent
Office.context.auth.getAccessTokenAsync({ forceConsent: true }, function (result) {
if (result.status === "succeeded") {
saveAttachmentsWithSSO(result.value, 1);
} else {
// Could not get SSO token, proceed with authentication prompt
saveAttachmentsWithPrompt(1);
}
});
} else {
// Could not get SSO token, proceed with authentication prompt
saveAttachmentsWithPrompt(123);
}
});
}
else {
// SSO not supported
saveAttachmentsWithPrompt(1);
}
}
此行Office.context.auth.getAccessTokenAsync
未捕获的TypeError:无法读取null的属性“ Version” 在Object.callback(outlook-web-16.01.js:16) 在rt(outlook-web-16.01.js:16) (匿名)@ Outlook-Web-16.01.js:16 rt @ Outlook-web-16.01.js:16