Action element

Specifies the action to perform when the user selects a Button or Menu controls.

Attributes

Attribute Required Description
xsi:type Yes Action type to take

Child elements

Element Description
FunctionName Specifies the name of the function to execute.
SourceLocation Specifies the source file location for this action.
TaskpaneId Specifies the ID of the task pane container.
Title Specifies the custom title for the task pane.
SupportsPinning Specifies that a task pane supports pinning, which keeps the task pane open when the user changes the selection.

xsi:type

This attribute specifies the kind of action performed when the user selects the button. It can be one of the following:

  • ExecuteFunction
  • ShowTaskpane

FunctionName

Required element when xsi:type is "ExecuteFunction". Specifies the name of the function to execute. The function is contained in the file specified in the FunctionFile element.

<Action xsi:type="ExecuteFunction">
  <FunctionName>getSubject</FunctionName>
</Action>

SourceLocation

Required element when xsi:type is "ShowTaskpane". Specifies the source file location for this action. The resid attribute must be set to the value of the id attribute of a Url element in the Urls element in the Resources element.

<Action xsi:type="ShowTaskpane">
  <SourceLocation resid="readTaskPaneUrl" />
</Action>

TaskpaneId

Optional element when  xsi:type is "ShowTaskpane". Specifies the ID of the task pane container. When you have multiple "ShowTaskpane" actions, use a different TaskpaneId if you want an independent pane for each. Use the same TaskpaneId for different actions that share the same pane. When users choose commands that share the same TaskpaneId, the pane container will remain open but the contents of the pane will be replaced with the corresponding Action "SourceLocation".

Note: This element is not supported in Outlook.

The following example shows two actions that share the same TaskpaneId.

<Action xsi:type="ShowTaskpane">
  <TaskpaneId>MyPane</TaskpaneId>
  <SourceLocation resid="aTaskPaneUrl" />
</Action>

<Action xsi:type="ShowTaskpane">
  <TaskpaneId>MyPane</TaskpaneId>
  <SourceLocation resid="anotherTaskPaneUrl" />
</Action>

The following examples show two actions that use a different TaskpaneId. To see these examples in context, see Simple Add-in Commands Sample.

<Action xsi:type="ShowTaskpane">
   <TaskpaneId>MyTaskPaneID1</TaskpaneId>
   <SourceLocation resid="Contoso.Taskpane1.Url" />
</Action>

<Action xsi:type="ShowTaskpane">
   <TaskpaneId>MyTaskPaneID2</TaskpaneId>
   <SourceLocation resid="Contoso.Taskpane2.Url" />
</Action>
<bt:Urls>
   <bt:Url id="Contoso.Taskpane1.Url" DefaultValue="https://commandsimple.azurewebsites.net/Taskpane.html" />
   <bt:Url id="Contoso.Taskpane2.Url" DefaultValue="https://commandsimple.azurewebsites.net/Taskpane2.html" />
</bt:Urls>

Title

Optional element when  xsi:type is "ShowTaskpane". Specifies the custom title for the task pane for this action.

The following examples show two different actions that use the Title element. To see these examples in context, see Script Lab manifest.

<Action xsi:type="ShowTaskpane">
<TaskpaneId>Office.AutoShowTaskpaneWithDocument</TaskpaneId>
<SourceLocation resid="PG.Code.Url" />
<Title resid="PG.CodeCommand.Title" />
</Action>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="PG.Run.Url" />
<Title resid="PG.RunCommand.Title" />
</Action>
<bt:Urls>
<bt:Url id="PG.Code.Url" DefaultValue="https://localhost:3000?commands=1" />
<bt:Url id="PG.Run.Url" DefaultValue="https://localhost:3000/run.html" />
</bt:Urls>
<bt:ShortStrings>
<bt:String id="PG.CodeCommand.Title" DefaultValue="Code" />
<bt:String id="PG.RunCommand.Title" DefaultValue="Run" />
</bt:ShortStrings>

SupportsPinning

Optional element when xsi:type is "ShowTaskpane". The containing VersionOverrides elements must have an xsi:type attribute value of VersionOverridesV1_1. Include this element with a value of true to support taskpane pinning. The user will be able to "pin" the taskpane, causing it to stay open when changing the selection. For more information, see Implement a pinnable taskpane in Outlook.

Note: SupportsPinning currently only supported by Outlook 2016 for Windows (build 7628.1000 or later).

<Action xsi:type="ShowTaskpane">
  <SourceLocation resid="readTaskPaneUrl" />
  <SupportsPinning>true</SupportsPinning>
</Action>