Export (0) Print
Expand All

Custom Action (Customization Policy)

SharePoint 2007

Specifies an item that is added to a menu or toolbar through a Feature.

Real World Example

A portal customer wants a set of new items to appear in the shortcut (context) menu of a document in a document library. Her developer creates a Feature that adds a custom action that calls a control to add the new items to the document shortcut menu when called.

Technical Details

A custom action modifies the list of items in menus and toolbars. A custom action could register a URL or ECMAScript (JScript, JavaScript code) action that is included in a menu or toolbar, or it could reference an assembly that contains a server-side control that renders the menu or toolbar item.

The following example, from the Applications.xml file of the AdminLinks feature, shows a custom action group and a custom action Feature that uses a static URL.

<CustomActionGroup Id="WebApplicationConfiguration" Location="Microsoft.SharePoint.Administration.ApplicationManagement" Title="$Resources:ApplicationManagement_WebApplicationConfiguration_Title;" Sequence="10" />
<CustomAction
Id="Extend" GroupId="WebApplicationConfiguration" Location="Microsoft.SharePoint.Administration.ApplicationManagement" Sequence="10" Title="$Resources:ApplicationManagement_Extend_Title;">
<UrlAction Url="/_admin/extendvsoption.aspx" />
</CustomAction>

The following example, from the SiteActionsMenuCustomization.xml file of the AddDashboard feature, is an example of a custom action Feature that uses a control class to determine the links.

<CustomAction Id="ReportListActionsMenuCustomizer" Location="Microsoft.SharePoint.StandardMenu" GroupId="SiteActions" Title="Report List Site Actions Menu Customization" ControlAssembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ControlClass="Microsoft.SharePoint.Portal.WebControls.ReportLibrarySiteActionsMenuCustomizer">
</CustomAction>

The following example, from the Links.xml file of the Hold feature, shows that the URLAction element can reference some built-in variables to make the URL less static.

<UrlAction Url="~site/_layouts/hold.aspx?ID={ItemId}&amp;List={ListId}"/>

Support Details

Custom actions have the standard support burden of Features, but rarely cause performance burden on code because of the lightweight nature of activities that are normally involved in generating items for a toolbar or menu. If a custom action uses a control class, the assembly must be installed in the global assembly cache.

Community Additions

ADD
Show:
© 2014 Microsoft