在 Outlook 加载项的上下文菜单中添加按钮时出现问题

Problems adding a button in the context menu for an Outlook Add-In

提问人:Mangeet Paramjit 提问时间:10/11/2023 更新时间:10/11/2023 访问量:19

问:

我正在尝试向 Outlook 的 Web 加载项添加自定义按钮。右键单击所选电子邮件后,该按钮应出现在上下文菜单中。我在这个xml文件中写了一些代码,但它不起作用。

<?xml version="1.0" encoding="UTF-8"?>
<!--Created:ce44715c-8c4e-446b-879c-ea9ebe0f09c8-->
<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">

    <!-- 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>6f86beb9-5454-4b6a-a6e5-8e5624a1a821</Id>

    <!--Version. Updates from the store only get triggered if there is a version change. -->
    <Version>1.0.0.0</Version>
    <ProviderName>ELFO</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="View Mail Content" />
    <Description DefaultValue="View the mail subject and content"/>
    <IconUrl DefaultValue="~remoteAppUrl/Images/button64.png"/>

    <SupportUrl DefaultValue="http://www.contoso.com" />
    <!-- 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>AppDomain1</AppDomain>
        <AppDomain>AppDomain2</AppDomain>
        <AppDomain>AppDomain3</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="~remoteAppUrl/MessageRead.html"/>
                <RequestedHeight>250</RequestedHeight>
            </DesktopSettings>
        </Form>
    </FormSettings>

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

    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
        <Requirements>
            <bt:Sets DefaultMinVersion="1.3">
                <bt:Set Name="Mailbox" />
            </bt:Sets>
        </Requirements>
        <Hosts>
            <Host xsi:type="MailHost">

                <DesktopFormFactor>
                    <!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
                    <FunctionFile resid="functionFile" />

                    <!-- Message Read -->
                    <ExtensionPoint xsi:type="MessageReadCommandSurface">
                        <!-- Use the default tab of the ExtensionPoint or create your own with <CustomTab id="myTab"> -->
                        <OfficeTab id="TabDefault">
                            <!-- Up to 6 Groups added per Tab -->
                            <Group id="msgReadGroup">
                                <Label resid="groupLabel" />
                                <!-- Launch the add-in : task pane button -->
                                <Control xsi:type="Button" id="msgReadOpenPaneButton">
                                    <Label resid="paneReadButtonLabel" />
                                    <Supertip>
                                        <Title resid="paneReadSuperTipTitle" />
                                        <Description resid="paneReadSuperTipDescription" />
                                    </Supertip>
                                    <Icon>
                                        <bt:Image size="16" resid="icon16" />
                                        <bt:Image size="32" resid="icon32" />
                                        <bt:Image size="80" resid="icon80" />
                                    </Icon>
                                    <Action xsi:type="ShowTaskpane">
                                        <SourceLocation resid="messageReadTaskPaneUrl" />
                                    </Action>
                                </Control>
                                <!-- Go to http://aka.ms/ButtonCommands to learn how to add more Controls: ExecuteFunction and Menu -->
                            </Group>
                        </OfficeTab>
                    </ExtensionPoint>

<ExtensionPoint xsi:type="ContextMenu">
  <OfficeMenu id="ContextMenuText">
    <Control xsi:type="Menu" id="TestMenu">
      <Label resid="ContextMenuLabel" />
      <Supertip>
          <Title resid="ContextualMenuTitle" />
          <Description resid="ContextualMenuTitleDesc" />
      </Supertip>
    </Control>         
  </OfficeMenu>
</ExtensionPoint>
                </DesktopFormFactor>
            </Host>
        </Hosts>

        <Resources>
            <bt:Images>
                <bt:Image id="icon16" DefaultValue="~remoteAppUrl/Images/icon16.png"/>
                <bt:Image id="icon32" DefaultValue="~remoteAppUrl/Images/icon32.png"/>
                <bt:Image id="icon80" DefaultValue="~remoteAppUrl/Images/icon80.png"/>
            </bt:Images>
            <bt:Urls>
                <bt:Url id="functionFile" DefaultValue="~remoteAppUrl/Functions/FunctionFile.html"/>
                <bt:Url id="messageReadTaskPaneUrl" DefaultValue="~remoteAppUrl/MessageRead.html"/>
            </bt:Urls>
            <bt:ShortStrings>
                <bt:String id="groupLabel" DefaultValue="My Add-in Group"/>
                <bt:String id="customTabLabel"  DefaultValue="My Add-in Tab"/>
                <bt:String id="paneReadButtonLabel" DefaultValue="View Mail Content"/>
                <bt:String id="paneReadSuperTipTitle" DefaultValue="Get subject and content"/>
            </bt:ShortStrings>
            <bt:LongStrings>
                <bt:String id="paneReadSuperTipDescription" DefaultValue="Opens a pane displaying all available properties. This is an example of a button that opens a task pane."/>
            </bt:LongStrings>
        </Resources>
    </VersionOverrides>
</OfficeApp>

这部分工作不正常

<ExtensionPoint xsi:type="ContextMenu">
  <OfficeMenu id="ContextMenuText">
    <Control xsi:type="Menu" id="TestMenu">
      <Label resid="ContextMenuLabel" />
      <Supertip>
          <Title resid="ContextualMenuTitle" />
          <Description resid="ContextualMenuTitleDesc" />
      </Supertip>
    </Control>         
  </OfficeMenu>
</ExtensionPoint>

我尝试添加这段代码:

<ExtensionPoint xsi:type="ContextMenu">
  <OfficeMenu id="ContextMenuText">
    <Control xsi:type="Menu" id="TestMenu">
      <Label resid="ContextMenuLabel" />
      <Supertip>
          <Title resid="ContextualMenuTitle" />
          <Description resid="ContextualMenuTitleDesc" />
      </Supertip>
    </Control>         
  </OfficeMenu>
</ExtensionPoint>

但上下文菜单中没有显示任何按钮。

JavaScript XML

评论


答: 暂无答案