I am trying to use Dialog API of Office Add-ins.
According to the doc, we could use Office.context.ui.messageParent
to send a message from the Dialog box to the host page (eg, task pane). Whereas, I don't see how we could send a message from the host page to the Dialog box.
Does anyone know how to do this?
There are 2 possible solutions:
- Send data as query params, when you open a pagein dialog box.
- If there are in same domain then localstorage should be available in dialog which was opened.
setInterval(function () { var value = localStorage.getItem("dataFromDialog"); }, 500)
You can write the same value in localStorage in dialog localStorageSetItem("dataFromDialog", "message to parent")