将Office365 REST日历ID映射到EWS CalendarItem ID [英] Mapping Office365 REST Calendar IDs to EWS CalendarItem IDs

查看:143
本文介绍了将Office365 REST日历ID映射到EWS CalendarItem ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Exchange 推送通知我已经创建了一项服务,可以同步来自Office365用户的日历数据.我一直在使用

Using Exchange push notifications I've been creating a service that syncs over calendar data from Office365 users. I've been using a combination of the Office365 Calendar REST API (to get and manage calendars) and the EWS API (to subscribe to calendar changes).

我注意到,最近,MS为其订阅端点引入了预览API.但是,此API仍处于预览模式,我希望暂时避免使用它.

I noticed that just recently MS has introduced a preview API for their subscription endpoints. However, this API is still in preview mode and I'd like to avoid using it for the time being.

一旦完成所有设置,问题是我无法在日历事件资源(REST)

Once I have everything setup, the problem is I can't make a correlation between the calendar event resource (REST) and the EWS CalendarItem resource that is returned on a push notification. The ItemId for the CalendarItem and the Id for the REST event differ.

当尝试更新我从REST API中保存的事件时,这被证明是有问题的,因为我找不到将两者关联的好方法.

When attempting to update the events that I've saved from the REST API this proves problematic since I cannot find a good method of associating the two.

任何帮助将不胜感激!

修改 经过进一步的挖掘之后,我实际上发现从REST API(GET /calendars)返回的日历似乎是EWS层次结构中的Message项目.因此,它不是返回该端点的实际文件夹ID,而是返回属于某个文件夹的项目ID",该文件夹称为公共视图".

Edit After some further digging, I've actually found that the calendars that are returned from the REST API (GET /calendars) appear to be Message items within the EWS hierarchy. So instead of this endpoint returning actual Folder IDs, it returns Item IDs that belong in some folder called "Common Views".

我不确定为什么要采用这种方式设计事物,但是base64编码ID的差异似乎很小.我仍然不知道将两者联系起来的好方法.

I'm not sure why things are designed this way, but the difference in the base64 encoded IDs seems to be very minimal. I just still can't figure out a good way to associate the two.

推荐答案

因此,由于通过Exchange2007版本订阅EWS推送通知,导致我的ID不匹配. Exchange2007_SP1及更高版本具有彼此兼容的EwsId,因此包括Office365.

So it turns out that my IDs mismatched due to subscribing to EWS push notifications via the Exchange2007 version. Exchange2007_SP1 and beyond have compatible EwsIds with each other so this includes Office365.

/替换-字符,并用+替换_字符使我能够正确地调用Office365 API资源.

Replacing - characters with / and _ characters with + allows me to properly make calls to Office365 API resources.

最后,当调用获取日历时,API是实际上返回了Common Views文件夹下的Message项目类型.因此,当尝试使用这些ID进行订阅时,EWS API会抱怨我发送给它的是ItemID,而不是文件夹ID.

Finally, when making a call to get calendars, the API is actually returning Message item types that live under the Common Views folder. So when attempting to use these IDs for subscriptions, the EWS API will complain that I've sent it ItemIDs and not a Folder ID.

非常感谢,我发现,只要将ID正确转换为URI安全类型(请参见上面的转换),就可以通过GET /calendars/ews_folder_id向REST API发出请求.

Thankfully I've found that making a request to the REST API via GET /calendars/ews_folder_id actually works once you properly translate the ID to a URI safe type (see above conversion).

这篇关于将Office365 REST日历ID映射到EWS CalendarItem ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆