Search code examples
javascriptoffice365office-addinsoutlook-web-appoutlook-web-addins

How to get recurrence data from JavaScript API in office365


I need to fetch recurrence data for appointments like Repeat, From, To fields. In addition, I also need to get daily, weekly, or monthly pattern details for my Outlook office Add-in while it is in compose mode.


Solution

  • In an Outlook web add-in when something is not available directly from Office.js library you can try to get access to those data using Exchange Web Services.

    Fortunately, Office.js provides two ways to access EWS.

    • You can request directly the EWS with a SOAP request from your client app. See method makeEwsRequestAsync in Office.context.mailbox
    • You can get an EWS token, send it to your server and make the request from there. Then you can use a nice SDK such as this one. You will invoke the method getCallbackTokenAsync from Office.Context.mailblox to retrieve such a token. In this link you will find an example on how to use this technique to retrieve email attachments (not available in Office.js)

    To answer more precisely, the EWS seems to expose the information you need regarding recurrence, To etc. for appointments, see this link.