Outlook Web Addin无法读取Outlook-web-16.01.js中null的属性“ Version”

时间:2019-03-19 09:28:14

标签: office-js outlook-web-addins

我正在尝试从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

0 个答案:

没有答案
相关问题