Definition

Elements and attributes

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute

Description

Command

Required. The name of a command. The value of this attribute matches the value of a Command attribute on an element that defines a control.

CommandAction

Required. A script statement to execute when this handler is invoked. Microsoft SharePoint Foundation calls the eval method, passing in the value of this attribute.

The value of the attribute can contain substitution tokens that are transformed at rendering. The following tokens are recognized:

{ItemId} - ID (GUID) taken from the list view.

{ItemUrl} - Web-relative URL of the list item (Url).

{RecurrenceId} - ID of a recurrent item (RecurrenceID).

{SiteUrl} - The fully qualified URL to the site (Url).

{ListId} - ID (GUID) of the list (ID).

{ListUrlDir} - Server-relative URL of the site plus the list's folder.

{Source} - Fully qualified request URL.

{SelectedListId} - ID (GUID) of the list that is currently selected from a list view.

{SelectedItemId} - ID of the item that is currently selected from the list view.

EnabledScript

Optional.

Note: The EnabledScript attribute doesn't work on custom actions deployed to the host web by an SharePoint Add-in.

A script statement that is executed to determine whether the command is enabled or disabled. The script expression should return a Boolean value, true if the command is enabled and false if not. If the ribbon is disabled, commands are grayed out and are not clickable.

As with the CommandAction attribute, the eval method is called with the value of this attribute as an argument. The EnabledScript attribute does not support the substitution tokens that are described for the CommandAction attribute.