How to tell when to use EWS vs rest API in Outlook Add-in

痞子三分冷 提交于 2019-12-22 18:20:13

问题


Is it possible to tell either in the XML file or through OfficeJs if the add-in can use the REST API or if it needs to use the older EWS API?

We have an Outlook add-in that needs to support OWA/O365 and Outlook 2016 with a stand alone exchange server. We are wondering if it is possible through the manifest XML file or through OfficeJs to detect the configuration of users account so we can properly access their content with the correct API. The only alternative I can see is to provide two separate add-ins for this, but I assume MS has a solution to this issue.


回答1:


There isn't a specific API for detecting the server version. You could determine if REST is supported for a given mailbox by checking the value of Office.context.mailbox.restUrl. If this is an on-prem installation it won't return a value.

UPDATE:

If restUrl is returning a result (i.e. https://exch1.mailhost.com/api) then REST should available and could begin using the Outlook REST APIs.



来源:https://stackoverflow.com/questions/45443232/how-to-tell-when-to-use-ews-vs-rest-api-in-outlook-add-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!