Share via


Custom Action Definitions

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Custom action files are included as a part of Features and are deployed as XML element descriptions. A custom action file is structured with a CustomAction element, which serves as the core definition for a single custom action of a link or toolbar item.

Elements

  CustomActionGroup

  HideCustomAction

  CustomAction

    UrlAction

Example

The following example defines a custom action file that you can bundle in the .wsp file of a solution.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomActionGroup 
    Id="VirtualServerConfiguration"
   Location="Microsoft.SharePoint.Administration.ApplicationManagement"
    Title="Virtual Server Configuration"
    Sequence="10"
    ImageUrl ="/images/listset.gif"
    Description="Use these links to install Windows SharePoint Services on a new virtual server, configure settings across all sites on a virtual server, or create a new top-level Web site. "/>
  <CustomAction 
    Id="Extend"
   Location="Microsoft.SharePoint.Administration.ApplicationManagement"
    Sequence="10" 
    Title="Extend or upgrade virtual server" 
    Description="">
    <UrlAction Url="vslist.aspx?NextPage=extendvsoption.aspx&amp;Show=NeedExtend&amp;Show=NeedUpgrade"/>
  </CustomAction>
  <CustomAction 
    Id="CreateSite"
   Location="Microsoft.SharePoint.Administration.ApplicationManagement"
    Sequence="20" 
    Title="Create a top-level Web site" 
    Description="">
    <UrlAction Url="vslist.aspx?NextPage=createsite.aspx&amp;Show=Ready"/>
  </CustomAction>
  <CustomAction 
    Id="DeleteSite"
   Location="Microsoft.SharePoint.Administration.ApplicationManagement"
    Sequence="30" 
    Title="Delete site collection" 
    Description="">
    <UrlAction Url="delsite.aspx"/>
  </CustomAction>
  <CustomAction 
    Id="ConfigureVirtualServer"
   Location="Microsoft.SharePoint.Administration.ApplicationManagement"
    Sequence="40" 
    Title="Configure virtual server settings" 
    Description="">
    <UrlAction Url="vslist.aspx?NextPage=vssettings.aspx"/>
  </CustomAction>
</Elements>

The CustomActionGroup element contains the core definition for a grouping of custom actions.

The UrlAction element must be used to specify the URL for a custom action. If no action is specified (an error condition), the link is displayed but it is not linked to anything.

Use the HideCustomAction element to hide an existing action that is implemented by default within the infrastructure of Windows SharePoint Services Features, or within another custom action. For a list of the default custom action IDs, see Default Custom Action Locations and IDs.

The next example shows an XML file whose contents replace default actions in a Windows SharePoint Services page with new actions. For a programming task that shows the steps for defining and registering custom actions, see How to: Add Actions to the User Interface.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
   <CustomActionGroup 
      Id="PortalAnalytics"
   Location="Microsoft.SharePoint.Administration.ApplicationManagement"
      Title="Usage Reporting"
      Sequence="50" />
   <CustomAction 
      Id="ManageAnalytics"
      GroupId="PortalAnalytics"
   Location="Microsoft.SharePoint.Administration.ApplicationManagement"
      Sequence="10" 
      Title="Configure usage reporting" >
      <UrlAction 
         Url="_layouts/SpUsageConfig.aspx"/>
   </CustomAction>
   <HideCustomAction
      Id="HideWssSiteCollectionUsage"
      HideActionId="SiteCollectionUsage"
      GroupId="SiteCollectionAdmin"
      Location="Microsoft.SharePoint.SiteSettings" />
   <HideCustomAction
      Id="HideWssWebUsage"
      HideActionId="WebUsage"
      GroupId="SiteAdministration"
      Location="Microsoft.SharePoint.SiteSettings" />
   <CustomAction
      Id="PortalSiteUsage"
      GroupId="SiteCollectionAdmin"
      Location="Microsoft.SharePoint.SiteSettings"
      Rights="ViewUsageData"
      Sequence="30"
      Title="Site usage data">
      <UrlAction
         Url="_layouts/SpUsageSite.aspx" />
   </CustomAction>
   <CustomAction
      Id="PortalWebUsage"
      GroupId="SiteAdministration"
      Location="Microsoft.SharePoint.SiteSettings"
      Rights="ViewUsageData"
      Sequence="30"
      Title="Web usage data">
      <UrlAction
         Url="_layouts/SpUsageWeb.aspx" />
   </CustomAction>
</Elements>

See Also

Concepts

Custom Action

Default Custom Action Locations and IDs

How to: Add Actions to the User Interface