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

Why is it unnecessary to invoke Office.onReady() for event based addins? #4932

Open
LiamWarnes opened this issue Dec 5, 2024 · 3 comments
Open
Assignees
Labels
Area: Outlook Feedback on Outlook content Needs: attention 👋 Waiting on Microsoft to provide feedback Type: doc request Request for new documentation or updates/enhancements to existing documentation

Comments

@LiamWarnes
Copy link

I had a smart alert in my add in that was not working in Outlook Classic because code was being invoked inside Office.onReady(). This is in accordance with the documentation provided here:

image

https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/autolaunch

This is a little confusing because it conflicts with guidance from https://learn.microsoft.com/en-us/office/dev/add-ins/develop/initialize-add-in that suggests onReady is necessary to invoke Office JS API's. Clearly, from the smart alert example provided here https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/smart-alerts-onmessagesend-walkthrough?tabs=jsonmanifest office JS API's are being invoked without predecessor of onReady().

Could you please provide extended clarification in the top documentation as to why it is unnecessary to invoke onReady in this context?

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label Dec 5, 2024
@samantharamon samantharamon self-assigned this Dec 9, 2024
@samantharamon samantharamon added Area: Outlook Feedback on Outlook content Type: doc request Request for new documentation or updates/enhancements to existing documentation Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels Dec 9, 2024
@samantharamon
Copy link
Contributor

Hi @LiamWarnes,

Thanks for reaching out. Office.onReady is only supported in the browser runtime. The code inside the Office.onReady function doesn't run in classic Outlook on Windows because the platform handles events in a JavaScript-only runtime (versus a browser runtime used by other supported platforms). As you suggested, I'll clarify this further in our documentation.

@LiamWarnes
Copy link
Author

@samantharamon id just like to note that in testing if you are developing for OWA you have to put Office.actions.associate inside the onReady() or the handler will not bind, and then in Outlook classic you need to put the associate Outside the Office.onReady()

assuming you want to keep the same JS file for both the WebView and JS runtime for all platforms, this does not work very intuitively....

@samantharamon
Copy link
Contributor

Thanks, @LiamWarnes. Let me see how we can document this behavior better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Outlook Feedback on Outlook content Needs: attention 👋 Waiting on Microsoft to provide feedback Type: doc request Request for new documentation or updates/enhancements to existing documentation
Projects
None yet
Development

No branches or pull requests

3 participants
@samantharamon @LiamWarnes and others