Access to Outlook RestAPI from an Outlook web Add-in

后端 未结 2 574

I developed an Outlook Web Add-in that is working fine. It\'s a Taskpane that is available in compose mode of appointments and that collects event\'s data, adds a few ones a

相关标签:
2条回答
  • 2020-12-11 20:01

    The previous answer is right, the error is because you are getting an item scoped token. Because previously Callback tokens only allowed a caller to call GetItem and GetItemAttachment REST APIs. We are making changes to the callback token so that clients can call REST of the APIs as well. The requirement is first you should have readWriteMailBox permission. Second get a REST callback token by providing isRest=true, like below

    Office.context.mailbox.getCallbackTokenAsync({ isRest: true }, function (result))
    

    The resulting token will have Mail.ReadWrite, Calendar.ReadWrite, Contacts.ReadWrite, and Mail.Send Scopes.

    That said the isRest parameter is only supported for outlook mobile client right now. The work to support it on OWA and Outlook is in progress and we expect to release it by March.

    0 讨论(0)
  • 2020-12-11 20:07

    You should use getCallbackTokenAsync() this is the JWT that will give you the AccessToken that will help you authenticating for the Outlook REST API

    https://dev.office.com/docs/add-ins/outlook/use-rest-api

    For your case, following the documentation, I think you will need ReadWriteMailbox to have sufficient permissions to register web hooks with Outlook REST API.

    NOTE: I tried this on my add-in, I changed the add-in permission to ReadWriteMailbox but the JWT token when inspected with JWT.io still has for scope:ParentId=<itemid> which I think won't work. Tell me if you have the same problem here.

    0 讨论(0)
提交回复
热议问题