outlookoffice-jsoutlook-addinoffice-addinsoutlook-web-addins

Error: Outlook can't send this message because there's a problem with the add-in


We are working on creating of Add-in for the Outlook. And it works correctly for normal cases. But we faced the problem that if the server with execute code for our add-in is down, then a user can't send email and get error 'Outlook can't send this message because there's a problem with the add-in [Add-in name]'.

We read this topic Outlook Add-In: Ignore On-send Event when Remote Service Unavailable and tried to change policy(https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/outlook-on-send-addins?tabs=windows#install-outlook-add-ins-that-use-on-send), but it doesn't help us.

What should we do to not stop sending email even if our add-in server is down?

manifest file

<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
           xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
           xsi:type="MailApp">
  <Id>some guid</Id>
  <Version>1.0.0.0</Version>
  <ProviderName>Test ProviderName</ProviderName>
  <DefaultLocale>da-DK</DefaultLocale>
  <DisplayName DefaultValue="Add-in name"/>
  <Description DefaultValue="Test description"/>

  <IconUrl DefaultValue="https://localhost:3000/assets/icon-64.png"/>
  <HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-128.png"/>

  <SupportUrl DefaultValue="https://localhost:3000/help"/>

  <AppDomains>
    <!-- All domains you want to access must be listed here (origin) -->
    <AppDomain>https://localhost:3000/</AppDomain>
    <AppDomain>https://localhost:5001/</AppDomain>

  </AppDomains>

  <Hosts>
    <Host Name="Mailbox"/>
  </Hosts>

  <Requirements>
    <Sets>
      <Set Name="Mailbox" MinVersion="1.1"/>
    </Sets>
  </Requirements>

   <!-- Old schema. This will be overridden by the VersionOverrides below. -->
  <FormSettings>
    <Form xsi:type="ItemEdit">
      <DesktopSettings>
        <SourceLocation DefaultValue="https://localhost:3000/commands.html"/>
      </DesktopSettings>
    </Form>
  </FormSettings>
  <!-- /Old schema. -->

  <Permissions>ReadWriteMailbox</Permissions>

  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Edit" />
  </Rule>

  <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">
      <Description resid="residAppDescription" />
      <Requirements>
        <bt:Sets DefaultMinVersion="1.3">
          <bt:Set Name="Mailbox" />
        </bt:Sets>
      </Requirements>

      <Hosts>
        <Host xsi:type="MailHost">
          <!-- Event-based activation happens in a lightweight runtime.-->
          <Runtimes>
            <!-- HTML file including reference to or inline JavaScript event handlers.
                 This is used by Outlook on the web and Outlook on the new Mac UI. -->
            <Runtime resid="WebViewRuntime.Url">
              <!-- JavaScript file containing event handlers. This is used by Outlook on Windows. -->
              <Override type="javascript" resid="JSRuntime.Url"/>
            </Runtime>
          </Runtimes>

          <DesktopFormFactor>
            <FunctionFile resid="WebViewRuntime.Url" />
            <ExtensionPoint xsi:type="Events">
              <!-- Using ItemSend allows us to open dialogs from the send event, as opposed to when using the
                  "Smart-Alert" on send handler.
                  The draw-back of this is that we cannot publish this add-in to Microsoft's AppSource.

                  The function must be on the global scope.
               -->
              <Event Type="ItemSend" FunctionExecution="synchronous" FunctionName="onMessageSendHandler" />
            </ExtensionPoint>

            <ExtensionPoint xsi:type="LaunchEvent">
              <LaunchEvents>
                <LaunchEvent Type="OnMessageCompose" FunctionName="onMessageComposeHandler"/>
                <LaunchEvent Type="OnMessageAttachmentsChanged" FunctionName="onMessageAttachmentsChangedHandler"/>
              </LaunchEvents>
              <SourceLocation resid="WebViewRuntime.Url"/>
            </ExtensionPoint>

          </DesktopFormFactor>
        </Host>
      </Hosts>
      <Resources>
        <bt:Urls>
          <!-- The JavaScript code is hosted on a secure and trusted web server. -->
          <bt:Url id="WebViewRuntime.Url" DefaultValue="https://localhost:3000/commands.html"/>
          <bt:Url id="JSRuntime.Url" DefaultValue="https://localhost:3000/commands.js" />
        </bt:Urls>
      </Resources>
    </VersionOverrides>
  </VersionOverrides>

</OfficeApp>


Solution

  • An on-send add-in will run if its backend is online and reachable. If the backend is offline, send is disabled.

    By default, the on-send policy is disabled which means the currently downloaded manifests of the on-send add-ins (not necessarily the latest versions) run on message or meeting items being sent. Administrators can enable the on-send policy by ensuring the user's group policy setting Block send when web add-ins can't load is set to Enabled. To disable the policy for a user, the administrator should set it to Disabled. To manage this policy setting, you can do the following:

    1. Download the latest Administrative Templates tool.
    2. Open the Local Group Policy Editor (gpedit.msc).
    3. Navigate to User Configuration > Administrative Templates > Microsoft Outlook 2016 > Security > Trust Center.
    4. Select the Block send when web add-ins can't load setting.
    5. Open the link to edit policy setting.
    6. In the Block send when web add-ins can't load dialog window, select Enabled or Disabled as appropriate then select OK or Apply to put the update into effect.

    In older versions of the Administrative Templates tool, the policy name was Disable send when web extensions can't load. Substitute in this name in later steps if needed.