I am creating an outlook Add-in in Visual Studio, when a User is Composing an email a pane opens where the user can select some data via checkboxes. What I need to be able to do is when the email is sent call a function that can read that data on the page then do some other stuff.
I have sent up a ExtensionPoint in my Manifest for ItemSend and there is a function file that points to functionFile.html which is connected to functionFile.js via a script tag.
When an email is sent my onEmailOrEventSend function is called, the issue is that once there I do not have access to the Html on original page.
Is there any way to do achieve this or a work around ?
<FunctionFile resid="functionFile" />
<ExtensionPoint xsi:type="Events">
<Event Type="ItemSend" FunctionExecution="synchronous" FunctionName="onEmailOrEventSend" />
</ExtensionPoint>
Any help would be appreciated
There is no need for any "workaround", this is exactly the case when you use Office JS Api to preserve with the message certain information and retrieve it at other times. When the user opens the taskpane and selects some data via checkboxes or other elements of the page, preserve the user choice in the message itself by using Office.CustomProperties interface. You would need to call once or several times set
method following by saveAsync
method. At other time, for example when the user recover the same message from the draft and opens the taskpane once again (you would want to re-initialize your taskpane checkboxes with the choice user did the last time) or on your onSend event as you described, you would retrieve the user selection from the message by using the method get
from the same interface. The exampls provided in the documentation on the Office.CustomProperties
interface.