无法使 Outlook 加载项 InsightMessage 工作

问题描述 投票:0回答:2

我有一个 Outlook 应用程序可以正常工作,使用 ErrorMessage,但我想尝试 InsightMessage 和相关操作,但运气不好 - 到目前为止;我能找到的唯一好的信息来源是Learn.Microsoft

我还在 Stack Overflow 上看到了这个相关的(?)问题

我正在尝试实现类似 Viva 的东西,请参见屏幕截图,其中有一条包含操作的消息,例如链接

应用程序运行但“没有任何反应”——我可以记录“结果”的值,它显示错误但没有详细信息

相关代码片段是

Office.context.mailbox.item.notificationMessages.replaceAsync("messageKey", {
    type: Office.MailboxEnums.ItemNotificationMessageType.InsightMessage,
    message: email.Notification.Message,
    icon: 'TeamsAssistLogo64x64',
    actions: [{
        actionText: 'Open insight',
        actionType: Office.MailboxEnums.ActionType.ShowTaskPane,
        commandId: 'msgReadOpenPaneButton',
        contextData: JSON.stringify({ a: 'aValue', b: 'bValue' })
    }]
})

笔记/问题

  1. 我真的不明白该应用程序如何识别另一个(任务窗格)应用程序?
  2. TeamsAssistLogo64x64 (.png) 在任务面板清单中定义
  3. 我不确定 msgReadOpenPaneButton;任务窗格清单包含
    <Control xsi:type="Button" id="msgReadOpenPaneButton">
    ;不知道对不对

发送清单

  <?xml version="1.0" encoding="utf-8"?>
<!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->

<!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
<Id>20bbdabc-cb35-442f-9965-28a6099b25c4</Id>

<!--Version. Updates from the store only get triggered if there is a version change. -->
<Version>3.16.2.1</Version>
<ProviderName>TeamsAssist</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
<DisplayName DefaultValue="TeamsAssist Notifications" />
<Description DefaultValue="TeamsAssist OnSend Notifications" />
<IconUrl DefaultValue="https://teamsassistoutlookonsend.azurewebsites.net/Images/TeamsAssistLogo64x64.png" />
<HighResolutionIconUrl DefaultValue="https://teamsassistoutlookonsend.azurewebsites.net/Images/TeamsAssistLogo128x128.png" />

<SupportUrl DefaultValue="https://cloudassist.co/" />   

<!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
<AppDomains>
  <AppDomain>https://teamsassistoutlookserver.azurewebsites.net</AppDomain>
  <AppDomain>https://teamsassistoutlooktaskpane.azurewebsites.net</AppDomain>     
</AppDomains>
<!--End Basic Settings. -->

<Hosts>
  <Host Name="Mailbox" />
</Hosts>
<Requirements>
  <Sets>
    <Set Name="Mailbox" MinVersion="1.1" />
  </Sets>
</Requirements>
<FormSettings>
  <Form xsi:type="ItemRead">
    <DesktopSettings>
  <SourceLocation DefaultValue="https://teamsassistoutlookonsend.azurewebsites.net/index.html?serverURL=https://teamsassistoutlookserver.azurewebsites.net/" />
      <RequestedHeight>250</RequestedHeight>
    </DesktopSettings>
  </Form>
</FormSettings>

<Permissions>ReadWriteItem</Permissions>

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

<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">
        <DesktopFormFactor>
          <!-- The functionfile and function name to call on message send.  -->
          <!-- In this particular case the function validateEmail will be called within the JavaScript code referenced in residUILessFunctionFileUrl. -->
          <FunctionFile resid="residUILessFunctionFileUrl" />
          <ExtensionPoint xsi:type="Events">
            <Event Type="ItemSend" FunctionExecution="asynchronous" FunctionName="validateEmail" />
          </ExtensionPoint>
        </DesktopFormFactor>
      </Host>
    </Hosts>
    <Resources>
      <bt:Urls>
        <!-- The JavaScript code is hosted on a secure and trusted web server. -->
        <bt:Url id="residUILessFunctionFileUrl" DefaultValue="https://teamsassistoutlookonsend.azurewebsites.net/index.html?serverURL=https://teamsassistoutlookserver.azurewebsites.net/"></bt:Url>
      </bt:Urls>
    </Resources>
  </VersionOverrides>
</VersionOverrides>
outlook office-js outlook-addin office-addins outlook-web-addins
2个回答
0
投票

要将通知项操作与任务窗格相关联,您可以指定

commandId
属性,该属性对应于用于打开任务窗格的功能区按钮。例如,您可以在清单文件中找到以下标记:

<Control xsi:type="Button" id="msgReadOpenPaneButton">
   <Label resid="TaskpaneButton.Label"/>
   <Supertip>
     <Title resid="TaskpaneButton.Label"/>
     <Description resid="TaskpaneButton.Tooltip"/>
   </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="ShowTaskpane">
     <SourceLocation resid="Taskpane.Url"/>
   </Action>
</Control>

您可以找到

Action
元素,它告诉功能区按钮用于打开由 URL 指定的任务窗格(请参阅
SourceLocation
元素)。


0
投票

我想我现在可以回答我自己的问题了:问题是最近引入了我想在智能警报的一部分中实施的 Insight Message - 我理解在这里描述

如其中所述,对于像我们自己的现有应用程序,这需要对清单进行大量修改;不仅如此,为了确保更新后的清单仍然有效,我还必须更新 XSD 文件

我还没有完全让它工作,但我相信它现在可以按要求运行

© www.soinside.com 2019 - 2024. All rights reserved.