I have been running into a blocker while developing an O365 Add-in.
Windows Desktop O365 issue: When opening my Add-in for the first time in a compose setting I have access to the Office.context.mailbox.item
, however all inline "Reply" and "Reply All"s have my cached Add-in. For this cached Add-in ItemChanged
async events do not have access toOffice.context.mailbox.item
unless we wait a moment. I.E. Office.context.mailbox.item
is undefined
.
So in summary the cached Add-in offers a complex issue. ItemChanged
shows when a user changes between emails. However what can I do if I have no access to the item
?
I thought I would also mention all pop-out "Reply" and "New message" work as anticipated, and all OWA works with the above logic.
Has anyone else faced this issue, or is there a work around of sorts to reestablish the mailbox item once the Add-in in a compose setting has cached?
Code running in my compose Add-in:
export class BaseModule {
constructor() {}
Office.context.mailbox.addHandlerAsync( Office.EventType.ItemChanged,
(eventType) => { console.log(Office.context.mailbox.item.itemId) }
}
let timer = setInterval(getOfficeItem, 1000);
function getOfficeItem {
if (Office.context.mailbox.item) {
// Your logic
clearInterval(timer);
}
}
Above is a block of code that I was able to come up with to await the Office item
on an ItemChanged
event
Update: This seems to have been fixed for replies but not drafts.