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

Issue when trying to unregister an event following the documentation examples #4909

Open
frankybboy96 opened this issue Nov 20, 2024 · 0 comments
Assignees
Labels
Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP

Comments

@frankybboy96
Copy link

Article URL

https://learn.microsoft.com/en-us/office/dev/add-ins/word/word-add-ins-events#remove-an-event-handler

Issue

The documentation gives instructions on how to register and then unregister events, but the provided code example isn't valid and doesn't work even in the most basic sense.

the eventContext.context provided as a param in the Word.run has a type mismatch and is not working.
image

trying to work around the issue by casting doesn't resolve the issue and just leads to the Word.run to throw
image
image

also the example provided doesn't take into account the possibility that eventContext could potentially be undefined or null, which is also wrong but easily fixed by adding some if(eventContext) where needed.

Questions

Is there another approved way of registering/unregistering events that I haven't found in the documentation?

Is there other ways to get notified of document changes that do not rely on the events?

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP
Projects
None yet
Development

No branches or pull requests

2 participants