Click to Rate and Give Feedback
Community Content
In this section
Statistics Annotations (21)
This page is specific to
The 2007 product release

Other versions are also available for the following:
Custom Action Definitions

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.

Xml
<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.

Xml
<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

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
How to Find CustomAction Identifiers      John Holliday ... Alex Angas   |   Edit   |   Show History
To hide a custom action, you must know the identifier of the action you wish to hide. For a table of default custom action identifiers, see http://johnholliday.net/resources/customactions.html. For code you can use to obtain the custom identifiers that have been deployed to the local farm, see http://johnholliday.net/post/2007/10/28/How-to-find-lt3bCustomActiongt3b-identifiers.aspx
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker