MessageComposeCommandSurface 在 1.1 中不起作用

MessageComposeCommandSurface doesn't work in 1.1

我想制作一个插件:

  1. 阅读电子邮件时可用
  2. 写邮件时可用
  3. 阅读电子邮件时可固定

到目前为止,我已经设法制作了一个清单,它可以满足 3 个要求中的 2 个,但不能同时满足所有 3 个要求。

有什么建议吗? - 除了创建两个加载项之外?

我的样本Manifest.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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>d23964fa-8ebb-4351-a07c-5348c5c88ce4</Id>
<Version>1.0.0.0</Version>
<ProviderName>@Fbsall</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="Git the gist" />
<Description DefaultValue="Allows users to access their GitHub gists." />
<IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png" />
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-80.png" />
<SupportUrl DefaultValue="https://localhost:3000/support.html" />

<AppDomains>
    <AppDomain>fbsall.com</AppDomain>
</AppDomains>

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

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

<FormSettings>
    <Form xsi:type="ItemRead">
        <DesktopSettings>
            <SourceLocation DefaultValue="https://localhost:3000/taskpane.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">
    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
        <Requirements>
            <bt:Sets DefaultMinVersion="1.3">
                <bt:Set Name="Mailbox" />
            </bt:Sets>
        </Requirements>

        <Hosts>

            <Host xsi:type="MailHost">
                <DesktopFormFactor>
                    <FunctionFile resid="Commands.Url" />
                    <!-- Message Compose -->
                    <ExtensionPoint xsi:type="MessageComposeCommandSurface">
                        <OfficeTab id="TabDefault">
                            <Group id="msgComposeCmdGroup">
                                <Label resid="GroupLabel" />
                                <Control xsi:type="Button" id="msgComposeInsertGist">
                                    <Label resid="TaskpaneButton.Label" />
                                    <Supertip>
                                        <Title resid="TaskpaneButton.Title" />
                                        <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>
                                <Control xsi:type="Button" id="msgComposeInsertDefaultGist">
                                    <Label resid="FunctionButton.Label" />
                                    <Supertip>
                                        <Title resid="FunctionButton.Title" />
                                        <Description resid="FunctionButton.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="ExecuteFunction">
                                        <FunctionName>insertDefaultGist</FunctionName>
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>
                    </ExtensionPoint>
                </DesktopFormFactor>
            </Host>

            <Host xsi:type="MailHost">
                <DesktopFormFactor>
                    <FunctionFile resid="Commands.Url" />

                    <ExtensionPoint xsi:type="MessageReadCommandSurface">
                        <OfficeTab id="TabDefault">
                            <Group id="msgReadCmdGroup">
                                <Label resid="GroupLabel" />
                                <Control xsi:type="Button" id="msgComposeInsertGist">
                                    <Label resid="TaskpaneButton.Label" />
                                    <Supertip>
                                        <Title resid="TaskpaneButton.Title" />
                                        <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>

                                <Control xsi:type="Button" id="msgComposeInsertDefaultGist">
                                    <Label resid="FunctionButton.Label" />
                                    <Supertip>
                                        <Title resid="FunctionButton.Title" />
                                        <Description resid="FunctionButton.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="ExecuteFunction">
                                        <FunctionName>insertDefaultGist</FunctionName>
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>
                    </ExtensionPoint>
                </DesktopFormFactor>
            </Host>

        </Hosts>
        <Resources>
            <bt:Images>
                <bt:Image id="Icon.16x16" DefaultValue="https://localhost:3000/assets/icon-16.png" />
                <bt:Image id="Icon.32x32" DefaultValue="https://localhost:3000/assets/icon-32.png" />
                <bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/assets/icon-80.png" />
            </bt:Images>
            <bt:Urls>
                <bt:Url id="Commands.Url" DefaultValue="https://localhost:3000/commands.html" />
                <bt:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html" />
            </bt:Urls>
            <bt:ShortStrings>
                <bt:String id="GroupLabel" DefaultValue="Git the gist" />
                <bt:String id="TaskpaneButton.Label" DefaultValue="Insert gist" />
                <bt:String id="TaskpaneButton.Title" DefaultValue="Insert gist" />
                <bt:String id="FunctionButton.Label" DefaultValue="Insert default gist" />
                <bt:String id="FunctionButton.Title" DefaultValue="Insert default gist" />
            </bt:ShortStrings>
            <bt:LongStrings>
                <bt:String id="TaskpaneButton.Tooltip" DefaultValue="Displays a list of your gists and allows you to insert their contents into the current message." />
                <bt:String id="FunctionButton.Tooltip" DefaultValue="Inserts the content of the gist you mark as default into the current message." />
            </bt:LongStrings>
        </Resources>
    </VersionOverrides>
</VersionOverrides>

我通过查看完全符合我要求的清单找到了答案。

我误解了 Hosts、Formfactor 和 ExtensionPoints 的声明方式。

正确的做法是这样的:

<Hosts>
    <Host xsi:type="MailHost">
        <DesktopFormFactor>
            <ExtensionPoint xsi:type="MessageComposeCommandSurface"></ExtensionPoint>
            <ExtensionPoint xsi:type="MessageReadCommandSurface"></ExtensionPoint>
        </DesktopFormFactor>

        <MobileFormFactor>
            <ExtensionPoint xsi:type="MessageComposeCommandSurface"></ExtensionPoint>
            <ExtensionPoint xsi:type="MessageReadCommandSurface"></ExtensionPoint>
        </MobileFormFactor>
    </Host>
</Hosts>

VersionOverride 1.0 中的所有内容都复制到 1.1 中。 SupportsPinning 在 1.1 中可用并且适用于 Compose 和 Read。