Aidal
Aidal

Reputation: 849

Office.context.mailbox.restUrl doesn't seem to work

I have an Outlook web addin that at some point calls the rest API to mark an e-mail with a flag.

This works as expected within my Outlook 2016 Windows client (on an Office 365 account), but on a different system (I believe the setup here is Exchange 2013 SP2 and Outlook 2013 clients) everything appears to work except getting the rest URL.

Office.context.mailbox.restUrl simply returns undefined which of cause makes the following rest call fail.

Permissions are set correctly to ReadWriteMailbox (or it wouldn't work on my own system), but I'm not sure if version of the other setup simply doesn't support this feature?

The manifest contains a section like this:

<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<Requirements>
  <bt:Sets DefaultMinVersion="1.3">
    <bt:Set Name="Mailbox" />
  </bt:Sets>
</Requirements>

But I'm not sure if that changes anything.

Anyone has an idea as to what the problem could be here?

Upvotes: 0

Views: 836

Answers (1)

erlangsec
erlangsec

Reputation: 2611

I believe there could be two reasons for why this doesn't work, and you appear to have found the first one:

API requirements set 1.5 is needed to access the property Office.context.mailbox.restUrl. This does not depend on the manifest.xml file DefaultMinVersion, but rather the actual Outlook client version you are running. DefaultMinVersion simply blocks your application from running in clients which do not support the specified requirements set. Office 2013 does not support 1.5.

The other possibility may be that your Exchange server does not support REST. The documentation says: "Outlook clients connected to on-premises installations of Exchange 2016 with a custom REST URL configured will return an invalid value for restUrl." (https://dev.office.com/reference/add-ins/outlook/1.5/Office.context.mailbox?product=outlook).

I searched a bit more into this, wondering if ANY on-premise Exchange setup would support REST, and found that either a hybrid or pure Exchange Online (Office 365) setup is required (https://social.msdn.microsoft.com/Forums/office/en-US/0503a37d-7869-4c39-a5c3-605e147e2079/support-for-rest-api-in-exchange-2016-onprem-only?forum=exchangesvrdevelopment).

Upvotes: 2

Related Questions