OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
641 stars 92 forks source link

On-send add-in with event based activation for attachment OnMessageAttachmentsChanged not getting loaded #4377

Closed pza-dev-brcm closed 3 weeks ago

pza-dev-brcm commented 1 month ago

I have created 2 add-ins for Outlook.

  1. First add-in is on-send add-in. Which gets triggered when the user compose a mail and sends it. For this we have added below in manifest.xml.

      <ExtensionPoint xsi:type="Events">
          <Event Type="ItemSend" FunctionExecution="synchronous" FunctionName="main" />
      </ExtensionPoint>
  2. Second add-in is event based add-in which gets invoked when attachment is added or removed from mail in compose window. For this we have added below in manifest.xml

      <ExtensionPoint xsi:type="LaunchEvent">
       <LaunchEvents>
        <LaunchEvent Type="OnMessageAttachmentsChanged" FunctionName="mainHandleAttachments" />
       </LaunchEvents>

These two add-in are working as expected independently.

Due to some business use case we want to combine on-send add-in and event based add-in (OnMessageAttachmentsChanged) into single add-in into single manifest.xml We don't want to use "OnMessageSend" event. we only want to combine OnMessageAttachmentsChanged with on-send add-in (Event Type="ItemSend" )

We tried adding below lines to manifest.xml but then add-in is not loading properly.

      <ExtensionPoint xsi:type="Events">
          <Event Type="ItemSend" FunctionExecution="synchronous" FunctionName="main" />
      </ExtensionPoint>

      <ExtensionPoint xsi:type="LaunchEvent">
       <LaunchEvents>
        <LaunchEvent Type="OnMessageAttachmentsChanged" FunctionName="mainHandleAttachments" />
       </LaunchEvents>

What is the correct way to do it ? Can we combine on-send add-in with only OnMessageAttachmentsChanged ? without using extra event handling for "OnMessageSend" ?

Your Environment Platform [PC desktop, Mac, iOS, Office on the web]: PC Desktop Host [Excel, Word, PowerPoint, etc.]: New Outlook Office version number: Microsoft Outlook Version 1.2024.103.100 (Production) | Client Version 20240119003.15 . Operating System: Windows11 Browser (if using Office on the web): NA

pza-dev-brcm commented 3 weeks ago

Hello, any update on the same ?

ajays-msft commented 3 weeks ago

@pza-dev-brcm Both are different events. There is no way to get attachment changed event during OnSend.

Thank you for the input. This is will considered as a new feature request. We track Outlook add-in feature requests on ourTech Community Page. Please submit your request there and choose the appropriate label(s). Feature requests on Tech Community are considered, when we go through our planning process.

ajays-msft commented 3 weeks ago

Re-activating as the discussion is on going.

@pza-dev-brcm - Is the updated manifest working in other platforms (Win32/Outlook Mac), or is it having issue only in OWA/Monarch?

pza-dev-brcm commented 3 weeks ago

It is started working now on OWA as well thick client. We are successfully able to upload the manifest file with code snippet mentioned in ticket itself.

ajays-msft commented 3 weeks ago

@pza-dev-brcm - Thank you for the update.