Open frankybboy96 opened 1 week ago
When can I expect to get any news relating to this?
@frankybboy96 This is a holiday week in the USA. @ElizabethSamuel-MSFT will be back next week. I the meantime, please install the ScriptLab tool from AppSource and try the sample in this screen shot. The code is similar to what is in the article. It will be valuable to see if the sample works in Script Lab or gives you and error. (It works perfectly for me.)
This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!
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 theWord.run
has a type mismatch and is not working.trying to work around the issue by casting doesn't resolve the issue and just leads to the
Word.run
to throwalso 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 someif(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?