如何确定何时在Outlook加载项中使用EWS与Rest API [英] How to tell when to use EWS vs rest API in Outlook Add-in

查看:73
本文介绍了如何确定何时在Outlook加载项中使用EWS与Rest API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在XML文件中或通过OfficeJs判断该加载项是否可以使用REST API或是否需要使用旧的EWS API?

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?

我们有一个Outlook加载项,需要使用独立的交换服务器来支持OWA/O365和Outlook 2016.我们想知道是否可以通过清单XML文件或OfficeJs检测用户帐户的配置,以便我们可以使用正确的API正确访问其内容.我唯一看到的替代方法是为此提供两个单独的加载项,但我认为MS可以解决此问题.

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.

推荐答案

没有用于检测服务器版本的特定API.您可以通过检查Office.context.mailbox.restUrl的值来确定给定邮箱是否支持REST.如果这是本地安装,则不会返回任何值.

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.

更新:

如果restUrl返回结果(即https://exch1.mailhost.com/api),则REST应该可用并且可以开始使用Outlook REST API.

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.

这篇关于如何确定何时在Outlook加载项中使用EWS与Rest API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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