小编Emp*_*Cup的帖子

Outlook Mac App身份验证令牌不匹配

我正在为Outlook实现一个加载项,加载项获取一个附件并将其发送到我的服务器进行处理.它在https://outlook.office.com上运行完美,但无法运行Outlook 2016 for Mac.

这是我试图访问的API:

var getMessageUrl =Office.context.mailbox.restUrl + '/v2.0/me/messages/' +
    {messageID} + "/attachments/" + {attachmentID};

var attachmentID = Office.context.mailbox.item.attachments[0].id;
var messageID = getItemRestId();

$.ajax({
    url: getMessageUrl,
    dataType: 'json',
    headers: {
        'Authorization': 'Bearer ' + outlookToken
    }
}).done(function 1(response) {
    //upload the blob to my server
}).fail(function (error) {
    //call authorise to get a new token
});

function getItemRestId() {
    if (Office.context.mailbox.diagnostics.hostName === 'OutlookIOS') {
        // itemId is already REST-formatted
        return Office.context.mailbox.item.itemId;
    } else {
        // Convert to …
Run Code Online (Sandbox Code Playgroud)

javascript office-addins office-js outlook-web-addins outlook-for-mac

5
推荐指数
1
解决办法
154
查看次数