1

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.

niton
  • 8,771
  • 21
  • 32
  • 52
user6012518
  • 53
  • 1
  • 5

1 Answers1

3

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.

Benoit Patra
  • 4,355
  • 5
  • 30
  • 53
  • Thank you benoit, I will check this and update you accordingly – user6012518 Mar 03 '16 at 12:12
  • Benoit thank you for your response but I cannot use makeEwsRequestAsync method as it expects appointment id or item id. Here I am composing a new appointment which doesn't have any appointment id, Now do I get whether its recurring or single appointment . – user6012518 Mar 04 '16 at 14:32
  • What about creating your appointment and use EWS to set its recurrence property later on? – Benoit Patra Mar 04 '16 at 16:13
  • Hello Benoit, Actually I am trying to get all information filled on compose state of appointment and then redirect user to our system where all filled information will be shown and then user can proceed further. but to our surprise office.js is not giving details about recurrence !!! Any help here is appreciated. – user6012518 Mar 07 '16 at 06:59
  • Do you want to redirect to your system after the appointment is saved? In other words, does the Exchange server has knowledge of this newly created appointment when your redirect? An option, would hook the event when the compose form closes then retrieve this missing info via EWS to put it in your own application. I do not see alternative, if the info is not proposed by Office.js an API/EWS approach is your only hope. – Benoit Patra Mar 07 '16 at 07:49
  • From what I understood your problem to retrieve the appointment via EWS is that you don't know its itemId. What you can do is order the appointments in EWS by CreationDate, the target appointment is the last one (you may check that there is no error with other fields, To etc.). This does not look very robust, but I managed to make something of the like working... – Benoit Patra Mar 07 '16 at 07:57
  • Thank you Benoit for your answers, but in both answers I need to save appointment. Actually I don't want to save appointment, I just want to grab information on these appointments in composed state and redirect to some other web page where I can show this information and once user click on save button on newly open my page we will make call to office365 to book appointment or meetings. Here on one of answer you mentioned about hooking event when form get closed. How to hook to particular event? When user tries to close form can I create any alert box here. – user6012518 Mar 07 '16 at 11:05