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

Elevated permission is required to call the method: 'mailbox.getUserIdentityToken'


Any ideas why an Outlook addin would be getting this error?

Elevated permission is required to call the method: 'mailbox.getUserIdentityToken'

Our manifest file specifies ReadWrite permissions:

<Permissions>ReadWriteItem</Permissions>
<Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Edit"/>
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read"/>
</Rule> 

It's only one user/account that is experiencing this issue out of hundreds.

Thank you.

An update: We solved the 'Elevated permission is required ...' problem but the method occasionally returns:

getUserIdentityTokenAsync failed - status: failed, error: Internal Error, code: 5001, message: An internal error has occurred.

We ignore this and try again later and it succeeds. Not sure what this error means.


Solution

  • For some reason if you schedule the method call for later in a timer then this "Elevated permission ..." error happens. We refactored our token refresh code to abandon using Timer and that seems to have fixed it!

    I guess Office API looses some important context when it's called in background, using Timers.