Search code examples
exchangewebservicesoutlook-addinoffice-addinsoutlook-web-addins

How to get User-Agent of Outlook add-in and use it for controlling access to EWS in Exchange


I'm a developer of one of Outlook add-ins.

We got a support request from one of our users about broken functionality related to attachments.

To get email attachments from our server we call EWS Managed API using ewsUrl and ewsToken passed from the client-side. Turns out, that Exchange admins can disable EWS and we were able to reproduce this.

We found this article which says that there's a way to enable EWS for specific apps:

Control access to EWS in Exchange

Admins of user's Exchange don't want to enable EWS for all users, so they want to enable it only for our app using this instruction: image.png This says that they can use a User-Agent string. So my question is how to get User-Agent for our Outlook add-in? Is this user agent string is fixed for each individual app or is it something we can set on our server in User-Agent header when we send requests to EWS?


Solution

  • Since you are posting the EWS request from your backend, you can set the user-agent header in the requests you send to EWS.