編輯

共用方式為


Host element

Specifies an individual Office application type where the add-in should activate.

Important

The <Host> element syntax varies depending on whether the element is defined within the basic manifest or within the VersionOverrides node. However, the functionality is the same.

Basic manifest

When defined in the basic manifest (under OfficeApp), the host type is determined by the Name attribute.

Attributes

Attribute Type Required Description
Name string Yes The name of the type of Office client application.

Name

Specifies the Host type targeted by this add-in. The value must be one of the following:

  • Document (Word)
  • Mailbox (Outlook)
  • Notebook (OneNote)
  • Presentation (PowerPoint)
  • Project (Project)
  • Workbook (Excel)
  • Database (Access (obsolete))

Example

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

VersionOverrides node

When defined in VersionOverrides, the host type is determined by the xsi:type attribute.

This element overrides the <Hosts> element in the basic manifest.

Add-in type: Task pane, Mail

Valid only in these VersionOverrides schemas:

  • Task pane 1.0
  • Mail 1.0
  • Mail 1.1

For more information, see Version overrides in the add-in only manifest.

Attributes

Attribute Required Description
xsi:type Yes Specifies the Office application where these settings apply.

Child elements

Element Required Description
DesktopFormFactor Yes Defines the settings for the desktop form factor.
MobileFormFactor No Defines the settings for the mobile form factor. Note: This element is only supported in Outlook on Android and iOS.
AllFormFactors No Defines the settings for all form factors. Only used by custom functions in Excel.
Runtimes No Specifies the runtimes of your add-in.

xsi:type

Controls which Office application (Word, Excel, PowerPoint, Outlook, OneNote) where the contained settings apply. The value must be one of the following:

  • Document (Word)
  • MailHost (Outlook)
  • Notebook (OneNote)
  • Presentation (PowerPoint)
  • Workbook (Excel)

Host example

<Hosts>
    <Host xsi:type="MailHost">
        <!-- Host Settings -->
    </Host>
</Hosts>