You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Outlook Web Add-in:如何屏蔽点击按钮时的默认通知消息

How to suppress the default "working on your request" notification in Outlook Web Add-ins

I’ve run into this exact frustrating issue before with Outlook Web Add-ins—those auto-populated default progress messages can totally clash with the custom feedback you want to show users. The good news is there’s a simple fix using your add-in’s manifest file.

The Root Cause

That "[Add-in Name] is working on your [Button Label] request" message is automatically triggered by Office.js whenever you have an ExecuteFunction action tied to a button, especially for asynchronous operations. To take full control of the notification experience, you just need to explicitly tell Office to suppress this default behavior.

Step-by-Step Fix

  1. Open your add-in’s manifest XML file (usually named something like manifest.xml or OfficeAddinManifest.xml).
  2. Locate the <Control> node for the button you’re modifying, which wraps the <Button> element.
  3. Add the <SuppressNotification>true</SuppressNotification> child element inside the <Button> tag. This tells Office not to render the default progress notification.

Here’s what the modified manifest snippet looks like:

<Control xsi:type="Button" id="MyCustomActionButton">
  <Label resid="Button_Label" />
  <Supertip>
    <Title resid="Button_Title" />
    <Description resid="Button_Description" />
  </Supertip>
  <Icon>
    <bt:Image size="16" resid="Icon_16x16" />
    <bt:Image size="32" resid="Icon_32x32" />
    <bt:Image size="80" resid="Icon_80x80" />
  </Icon>
  <Action xsi:type="ExecuteFunction">
    <FunctionName>handleCustomButtonClick</FunctionName>
  </Action>
  <!-- This line suppresses the default notification -->
  <SuppressNotification>true</SuppressNotification>
</Control>

Verify with Your Custom Notification

After updating the manifest, re-sideload or redeploy your add-in. Now when users click the button, the default message won’t pop up, and your custom progress notification will be the only feedback they see. Here’s a quick reminder of how to structure your JavaScript code for the custom message:

function handleCustomButtonClick() {
  const customProgressMsg = "Processing your request—hang tight!";
  
  // Show your custom progress indicator
  Office.context.mailbox.item.notificationMessages.replaceAsync(
    'customProgress',
    { type: 'progressIndicator', message: customProgressMsg },
    (result) => {
      if (result.error) {
        console.error("Failed to show custom notification:", result.error.message);
      }
    }
  );

  // Run your actual async logic here
  yourAsyncBusinessLogic()
    .then(() => {
      // Update notification to success message
      Office.context.mailbox.item.notificationMessages.replaceAsync(
        'customProgress',
        { type: 'informationalMessage', message: "Request completed successfully!", icon: 'icon-success', persistent: false }
      );
    })
    .catch((err) => {
      // Update notification to error message
      Office.context.mailbox.item.notificationMessages.replaceAsync(
        'customProgress',
        { type: 'errorMessage', message: `Request failed: ${err.message}`, persistent: false }
      );
    });
}

Key Notes

  • This SuppressNotification attribute only works with ExecuteFunction type actions. If you’re using a ShowTaskpane action, the default notification behavior is different, but for your use case (triggering a function and showing custom progress), this should be perfect.
  • Double-check the placement: the element needs to be inside the <Button> tag, not under the <Action> element—this is a common mistake that breaks the fix.

内容的提问来源于stack exchange,提问作者CodingFanSteve

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 04:05:28