Search code examples
outlook-web-addinsofficedev

MessageComposeCommandSurface doesn't work in 1.1


I want to make an Add-in that :

  1. Is available when Reading an email
  2. Is available when Writing an email
  3. Is Pinnable when Reading an email

So far I've managed to make a Manifest that can achieve 2 out of 3 requirements but not all 3 in the same time.

  • 1+2 is possible with VersionOverrides V1.0 but NOT V1.1
  • 1+3 is possible with VersionOverrides V1.1 but NOT V1.0
  • Pinning is only possible in 1.1 but then i loose (2)

Any advice ? - other than creating TWO add-ins ?

My sample 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>

Solution

  • I found the answer by looking through a manifest that does exactly what i want.

    I had misunderstood how Hosts, Formfactor and ExtensionPoints are declared.

    The correct way is something like this:

    <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>
    

    All content in VersionOverride 1.0 is copied into 1.1. SupportsPinning is available in 1.1 and works for both Compose and Read.