Elements 要素 (カスタム アクション)

適用対象: SharePoint 2016 |SharePoint Foundation 2013 |SharePoint Online |SharePoint Server 2013

フィーチャー要素の宣言が含まれるフィーチャー マニフェスト ファイルの最上位要素です。

定義

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

要素と属性

以下のセクションで、属性、子要素、親要素について説明します。

属性

属性 説明
xmlns 必須です。 XML 名前空間を識別します。 値は である http://schemas.microsoft.com/sharepoint/必要があります。
ID オプションの Text。 フィーチャー マニフェスト ファイルを表す一意識別子を指定します。

子要素

親要素

None

次の例では、ボタンを [サーバー] リボンに追加するカスタム アクションを定義します。

<Elements xmlns="http://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>