Sharepoint Custom Action Element Definition

Sharepoint Custom Action Element Definition

Every time I need this, I have a heck of a time finding it.  So I thought I would post it here:

The <CustomAction> Element

The <CustomAction> element is used to create a new custom action in the UI. In the above samples, two custom actions are created:

  • A custom action (named My Custom Action) in a custom action group (named My Action Group) in the Site Settings screen.
  • A custom action (named My New Custom Action) in an existing action group (which is the Site Actions menu).

The following attributes can be used with this element:

  • Id - (optional) Unique identifier to the custom action. The ID can be GUID or unique term, for example, "MyCustomAction".
  • Description - (optional) Description for the custom action. It will be displayed as a tooltip or sub-description for the action, depending on its location.
  • Title - (required) Title for the custom action.
  • GroupId - (optional) Specifies an action group inside which to place the custom action. If this custom action is contained inside a custom action group, the value of this attribute must match the value of the Id attribute of the <CustomActionGroup> element.
  • Location - (required) Specifies the location for this custom action. If this custom action is contained inside a custom action group, the value of this attribute must match the value of the Location attribute of the <CustomActionGroup> element. Check the possible values below, in the Locations and Group IDs section.
  • ImageUrl - (optional) Address of the image to use as the icon for this custom action. Note that, in certain locations, the custom actions don't have an icon.
  • Rights - (optional) Specifies a set of permissions that the user must have in order for the link to be visible. If omitted, the action always appears. To specify multiple values, separate them using commas (which means the user must have all the permissions specified). Check the possible values below, in the Action Rights section.
  • RequireSiteAdministrator - (optional) TRUE to specifiy that the user must be a site administrator to see the custom action. The default value is FALSE. This attribute is not supported if the custom action is to be placed in the context menu for a list item.
  • Sequence - (optional) Specifies the order of the custom action inside its action group.
  • ContentTypeId - (optional) Specifies the ID of the content type to associate with the custom action.
  • ShowInReadOnlyContentTypes - (optional) TRUE to specify that the action should only appear in the Manage Content Type screen, for Read Only Content Types. The default value is FALSE.
  • ShowInSealedContentTypes - (optional) TRUE to specify that the action should only appear in the Manage Content Type screen, for Sealed Content Types. The default value is FALSE.
  • ControlAssembly - (optional) Specifies the fully qualified name of the assembly of the control that supports the custom action. This attribute is used in conjunction with the next one.
  • ControlClass - (optional) Specifies the name of the class of the control that supports the custom action. This attribute is used in conjunction with the previous one.
  • ControlSrc - (optional)
  • RegistrationType - (optional) Used to specify the type of attachment in per-item custom actions. The possible values are:
    • ContentType
    • FileType
    • List
    • ProgId
  • RegistrationId - (optional) Depending on the RegistrationType value, this attribute can hold a Content Type ID, a File Type identifier, a List ID or a Program identifier.

 

 

The <UrlAction> Element

The <UrlAction> element is used inside the <CustomAction> element to specify what happens when the user clicks the link (or toolbar button, or menu item). It has a single attribute, Url, which is the address of the page to redirect the user to.

In this URL address you can use a few tokens that SharePoint will replace by the correct values when the user clicks it:

  • ~site - relative address of the current web site.
  • ~sitecollection - relative address of the root web site of the current site collection.
  • {ItemId} - ID (Integer value) of the item being acted upon (if applicable).
  • {ItemUrl} - URL of the item being acted upon (only works in document libraries).
  • {ListId} - GUID of the list.
  • {SiteUrl} - absolute URL of the current web site.
  • {RecurrenceId} - Recurrence index (not supported in the context menu of list items).
The <HideCustomAction> Element

The <HideCustomAction> element is used to hide an existing custom action.

The following attributes can be used with this element:

  • Id - (optional) Specifies the ID of this hide custom action element.
  • GroupId - (optional) Identifies an action group that contains the action.
  • Location - (required) Specifies the location of the custom action to hide. Check the possible values in the table below.
  • HideActionId - (required) Specifies the ID of the action to hide.

Locations and Group IDs

The location and group ID values identify a specific place where the custom action must be created (or hidden). See below the possible combinations for both attributes.

Description Location Group ID
Display form toolbar DisplayFormToolbar N/A
Edit form toolbar EditFormToolbar N/A
New form toolbar NewFormToolbar N/A
List view toolbar ViewToolbar N/A
List item context menu EditControlBlock N/A
New menu for list and document library view toolbars Microsoft.SharePoint.StandardMenu NewMenu
Actions menu for list and document library view toolbars Microsoft.SharePoint.StandardMenu ActionsMenu
Settings menu for list and document library view toolbars Microsoft.SharePoint.StandardMenu SettingsMenu
Upload documents menu for document libraries Microsoft.SharePoint.StandardMenu UploadMenu
Site Actions menu Microsoft.SharePoint.StandardMenu SiteActions
Site Settings Site Collection Administration links Microsoft.SharePoint.SiteSettings SiteCollectionAdmin
Site Settings Site Administration links Microsoft.SharePoint.SiteSettings SiteAdministration
Site Settings Galleries Links Microsoft.SharePoint.SiteSettings Galleries
Site Settings Look and Feel links Microsoft.SharePoint.SiteSettings Customization
Site Settings Users and Permissions links Microsoft.SharePoint.SiteSettings UsersAndPermissions
Site Actions menu for surveys Microsoft.SharePoint.StandardMenu ActionsMenuForSurvey
Site Settings links for surveys Microsoft.SharePoint.SiteSettings SettingsMenuForSurvey
Content Type Settings links Microsoft.SharePoint.ContentTypeSettings N/A
Central Administration Operations page Microsoft.SharePoint.Administration.Operations N/A
Central Administration Application Management page Microsoft.SharePoint.Administration.ApplicationManagement N/A

Action Rights

Each custom action has its own set of permission requirements which are defined using the Rights attribute of the <CustomAction> element. The list below summarizes the possible values for this attribute.

  • AddAndCustomizePages - Add, change, or delete HTML pages or Web Part Pages, and edit the Web site using a Windows SharePoint Services–compatible editor.
  • AddDelPrivateWebParts - Add or remove personal Web Parts on a Web Part Page.
  • AddListItems - Add items to lists, add documents to document libraries, and add Web discussion comments.
  • ApplyStyleSheets - Apply a style sheet (.css file) to the Web site.
  • ApplyThemeAndBorder - Apply a theme or borders to the entire Web site.
  • ApproveItems - Approve a minor version of a list item or document.
  • BrowseDirectories - Enumerate files and folders in a Web site using Microsoft Office SharePoint Designer 2007 and WebDAV interfaces.
  • BrowseUserInfo - View information about users of the Web site.
  • CancelCheckout - Discard or check in a document which is checked out to another user.
  • CreateAlerts - Create e-mail alerts.
  • CreateGroups - Create a group of users that can be used anywhere within the site collection.
  • CreateSSCSite - Create a Web site using Self-Service Site Creation.
  • DeleteListItems - Delete items from a list, documents from a document library, and Web discussion comments in documents.
  • DeleteVersions - Delete past versions of a list item or document.
  • EditListItems - Edit items in lists, edit documents in document libraries, edit Web discussion comments in documents, and customize Web Part Pages in document libraries.
  • EditMyUserInfo - Allows a user to change his or her user information, such as adding a picture.
  • EmptyMask - Has no permissions on the Web site. Not available through the user interface.
  • EnumeratePermissions - Enumerate permissions on the Web site, list, folder, document, or list item.
  • FullMask - Has all permissions on the Web site. Not available through the user interface.
  • ManageAlerts - Manage alerts for all users of the Web site.
  • ManageLists - Create and delete lists, add or remove columns in a list, and add or remove public views of a list.
  • ManagePermissions - Create and change permission levels on the Web site and assign permissions to users and groups.
  • ManagePersonalViews - Create, change, and delete personal views of lists.
  • ManageSubwebs - Create subsites such as team sites, Meeting Workspace sites, and Document Workspace sites.
  • ManageWeb - Grant the ability to perform all administration tasks for the Web site as well as manage content. Activate, deactivate, or edit properties of Web site scoped Features through the object model or through the user interface (UI). When granted on the root Web site of a site collection, activate, deactivate, or edit properties of site collection scoped Features through the object model. To browse to the Site Collection Features page and activate or deactivate site collection scoped Features through the UI, you must be a site collection administrator.
  • Open - Allow users to open a Web site, list, or folder to access items inside that container.
  • OpenItems - View the source of documents with server-side file handlers.
  • UpdatePersonalWebParts - Update Web Parts to display personalized information.
  • UseClientIntegration - Use features that launch client applications; otherwise, users must work on documents locally and upload changes.
  • UseRemoteAPIs - Use SOAP, WebDAV, or Microsoft Office SharePoint Designer 2007 interfaces to access the Web site.
  • ViewFormPages - View forms, views, and application pages, and enumerate lists.
  • ViewListItems - View items in lists, documents in document libraries, and view Web discussion comments.
  • ViewPages - View pages in a Web site.
  • ViewUsageData - View reports on Web site usage.
  • ViewVersions - View past versions of a list item or document.

你可能感兴趣的:(SharePoint)