Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outlook Add-in - Call to mailbox.getUserIdentityTokenAsync returning undefined token for only some Outlook accounts #5487

Open
madhukar4e opened this issue Mar 13, 2025 · 3 comments
Assignees
Labels
Area: Outlook Issue related to Outlook add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback Possible-Solution Similar-Issue

Comments

@madhukar4e
Copy link

madhukar4e commented Mar 13, 2025

I am working on a previously fully-functional Outlook Add-in that is having issues retrieving the mailbox.getUserIdentityTokenAsync only for some Outlook accounts.

Your Environment

  • Platform: PC desktop, Mac
  • Host: Outlook
  • Outlook version number: 16.95
  • Operating System: MacOS Sequoia

Expected behavior

All Outlook accounts are able to successfully retrieve an ExchangeIdentityToken upon calling: Office.context.mailbox.getUserIdentityTokenAsync()

Current behavior

Some accounts (no discernable pattern) fail to retrieve the token and produce the following error response:
"Internal protocol error: '-2147467259'."
and "AccessRestricted".

Steps to reproduce

  1. Use a random Outlook test account
  2. Initialize add-on with call to Office.context.mailbox.getUserIdentityTokenAsync()
  3. Check (using web inspector or debugger) to see if a token has sent in the response.
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label Mar 13, 2025
Copy link

Here are some similar issues that might help you. Please check if they can solve your problem.


Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)

Solution 1:

This should be resolved. Please let us know how that looks for you now. Apologies for the disruption.

Reference:

Solution 2:

From your sample code you do not appear to be registered for item change events. If you want to support pinning, you need to call addHandlerAsync() with the itemChanged event. I've created a short ScriptLab gist file with an example here: https://gist.github.com/exextoc/cdda502b27dbb69bfd98a9e5b12f4767

Reference:

Solution 3:

Depending on your scenario, you can have useEffect in both initialize and the addHandlerAsync. A number of things could stop working if AddHandlerAsync / ItemChanged is not included with a pinnable taskpane, even though getUserIdentityTokenAsync() does not depend on the item. Calls to getUserIdentityToken should succeed once you include addHandlerAsync() no matter when they were called.

Reference:

Powered by issue-sentinel

@exextoc exextoc added Area: Outlook Issue related to Outlook add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels Mar 13, 2025
@exextoc exextoc self-assigned this Mar 13, 2025
@madhukar4e
Copy link
Author

Image

@jedmonsanto
Copy link

any news about the error? Mine has something like this:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Outlook Issue related to Outlook add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback Possible-Solution Similar-Issue
Projects
None yet
Development

No branches or pull requests

4 participants