2

I am trying to find a way to map/convert the Id returned from Office 365 REST API (GET /calendars) to the Ids returned from EWS (list folders on DistinguishedFolderId="calendar") or vice-versa.

I have noticed that for same calendar the Id returned from Office 365 API differs to that returned from EWS API.

Office 365 API - 
"AAMkADRlYTIyZTNiLWQ1ZjQtNGQwOS1hOGYzLTFjY2NkYzM4MzA2NwBGAAAAAAAhWNzR1hCyToyWVDoyJaPGBwAPTshXMc1wTqPkmdHO8phYAAAAAAEGAAAPTshXMc1wTqPkmdHO8phYAAB-AHbjAAA="

EWS API - 
"AAMkADRlYTIyZTNiLWQ1ZjQtNGQwOS1hOGYzLTFjY2NkYzM4MzA2NwAuAAAAAAAhWNzR1hCyToyWVDoyJaPGAQAPTshXMc1wTqPkmdHO8phYAAB/AHL6AAA="

I am unable to figure out a way for associating both. I want to have a clear mapping/conversion between these.

Edit 1: It turns out that, Id returned from Office 365 REST API when used on EWS(after replacing '-' with '/' and '_' with '+'), corresponds to a Item of type 'Message' under some 'Common Views' folder. This looks to be a strange design. Is the replacement mentioned above sufficient? Or there are other characters that should be replaced?

P.S:

  1. I have already referred to http://stackoverflow.com/questions/30082306/mapping-office365-rest-calendar-ids-to-ews-calendaritem-ids, but it does not work in my case(as the length of the Ids are different).
  2. I have seen this doc on ConvertId operation. But I am unable to understand how to apply it in this case. Because the Id I am using "RequestServerVersion Version="Exchange2010" which should be the version for Office 365 API also.
aditya
  • 182
  • 4
  • 13
  • Are they normal appointments or a recurring instance ? – Glen Scales Apr 06 '17 at 01:03
  • These are Calendars on EWS and Office 365. After some experimenting and reading Edit on [this](http://stackoverflow.com/questions/43230434/mapping-converting-office-365-rest-api-calendar-id-to-ews-calendar-id), I learnt that REST API (GET /calendars) returns items with Id that correspond to 'Messages' on EWS under some folder 'Common Views'. – aditya Apr 06 '17 at 05:02
  • I am trying to find a way to map/convert the Id returned from Office 365 REST API (GET /calendars) to the Ids returned from EWS (list folders on DistinguishedFolderId="calendar"). – aditya Apr 06 '17 at 05:03
  • Then you might want to fix your question as it sounds like the Id's you posting don't represent that same thing eg you just comparing an ItemId to a FolderId. And when you say convert what are you going to convert the id to? eg if you have the Id you should just bind to the Item in question with EWS or REST. It more likely you would need to do more processing on that item (eg you never going to be able to convert and ItemId for an Item in the Common views folder to a FolderId) – Glen Scales Apr 06 '17 at 06:11
  • I am trying to capture calendar and events within them from Exchange Online, and in order to do an efficient sync I am using a hybrid approach with EWS and Office 365 APIs. For this, I need to map the calendars returned from both the APIs. I have mentioned convert, because after seeing EWS ConvertId API, I was under impression that a conversion might be possible. – aditya Apr 06 '17 at 06:58
  • I have found a way to map the Ids, which goes as follow: Get calendar Id from EWS API. Replace '/' with '-' and '_' with '+'. Use this Id with Office 365 REST /calendars/{EWS Id} This API returns the calendar, with the corresponding Id as per office 365(which would be of that Item under Common Views) folder. ALthough it works, I am unable to find any documentation etc with this mapping. Should I get it confirmed from someone at MS? – aditya Apr 06 '17 at 07:01

1 Answers1

2

I have found a way for mapping/associating the Ids of calendars returned from Office 365 REST and EWS API.

Use EWS GET Folder API with DistinguishedFolderId="calendar" to get the folder id of calendar. Call EWS list folders API to get all other calendars on Exchange.

Now, mapping these Ids to that returned from Office 365: For each calendar returned above, call Office 365 REST API(/calendar/{id}). This API returns corresponding calendar from Office 365 with a new Id(i.e. Office 365 identifier for the same). Interestingly, this Id corresponds to a message item under "Common Views" folder on EWS.

Although, it works through trial I am unable to find any MS document explaining this.

Does anyone have any idea about this behaviour?

aditya
  • 182
  • 4
  • 13