Compartilhar via


Elements Element (Custom Action)

Applies to: SharePoint Foundation 2010

Top-level element in a Feature manifest file that contains Feature element declarations.

<Elements
  Id = "Text">
</Elements>

Attributes

Attribute

Description

xmlns

Required. Identifies the XML namespace. The value must be https://schemas.microsoft.com/sharepoint/.

Id

Optional Text. Specifies a unique identifier for the Feature manifest file.

Child Elements

CustomAction

CustomActionGroup

HideCustomAction

Parent Elements

None

Example

The following example defines a custom action that adds a button to the Server ribbon.

<Elements xmlns="https://schemas.microsoft.com/sharepoint/">
  <CustomAction 
    Id="Ribbon.Library.Actions.AddAButton"
    Location="CommandUI.Ribbon"
    RegistrationId="101"
    RegistrationType="List"
    Title="Add a Ribbon Button">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.Library.Share.Controls._children">
          <Button Id="Ribbon.Library.Share.NewRibbonButton"
            Command="NewRibbonButtonCommand"
            Image16by16="Insert an image URL here."
            Image32by32="Insert an image URL here."
            LabelText="Hello World"
            TemplateAlias="o2" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler 
          Command="NewRibbonButtonCommand"
          CommandAction="javascript:alert('Hello, world');" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>