outlookmicrosoft-graph-apioutlook-addinoutlook-web-addinsoffice365api

When i add the "ItemSend" Event handler in my add-ins manifest.xml thrown error while installing the add-ins


In outlook add-ins try to add the ItemSend Event handling trigger in the manifest file ,but when i try to install manifest.xml not installing some error thrown

How to add the item send Event handler on my outlook add-ins

How to trigger this when click the save button , how to trigger the event on my commands.js file

Note : my add-ins developed by using javascript

Any thought about that please share me

Thanks in advance


Solution

  • First of all, make sure the right requirement set is specified in the manifest file. You must specify at least the 1.8 set for the ItemSend event because the on-send feature was officially released in requirement set 1.8. Read more about requirement sets in the Requirements for running Office Add-ins article.

    In the manifest file, you typically need to include the function file and function name that should be called on the ItemSend event. The operation runs synchronously.

    <Hosts>
        <Host xsi:type="MailHost">
            <DesktopFormFactor>
                <!-- The functionfile and function name to call on message send.  -->
                <!-- In this case, the function validateBody will be called within the JavaScript code referenced in residUILessFunctionFileUrl. -->
                <FunctionFile resid="residUILessFunctionFileUrl" />
                <ExtensionPoint xsi:type="Events">
                    <Event Type="ItemSend" FunctionExecution="synchronous" FunctionName="validateBody" />
                </ExtensionPoint>
            </DesktopFormFactor>
        </Host>
    </Hosts>
    

    The on-send API requires VersionOverrides v1_1. The following XML markup shows you how to add the VersionOverrides node in your manifest.

     <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
         <!-- On-send requires VersionOverridesV1_1 -->
         <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
             ...
         </VersionOverrides>
    </VersionOverrides>
    

    Read more about that in the On-send feature for Outlook add-ins article.

    You may also find the Outlook-Add-in-On-Send sample add-in on GitHub.