CommandUIDefinition 要素

最終更新日: 2015年3月9日

適用対象: SharePoint Foundation 2010

この記事の内容
属性
子要素
親要素
出現回数

ユーザー インターフェイスを定義する要素を含めます。

<CommandUIDefinition
  Location = "Text"
 />

属性

属性

説明

Location

オプションの Text。このコマンドの場所を指定します。Microsoft SharePoint Foundation で使用される既定の場所の一覧については、「既定のサーバー リボンのカスタマイズの場所」を参照してください。

子要素

Button

CheckBox

ComboBox

ColorPicker

ContextualGroup

ContextualTabs

Controls

DropDown

FlyoutAnchor

Gallery

GalleryButton

GroupTemplate

Group

Groups

InsertTable

Label

MRUSplitButton

MaxSize

Menu

MenuSection

QAT

Ribbon

Scale

Scaling

Spinner

SplitButton

Tab

Tabs

TextBox

ToggleButton

親要素

CommandUIExtension

出現回数

最小: 1

最大: 制約なし

次の例では、グループを持つ新しい [My Custom Tab] タブおよび 3 つのボタンがドキュメント ライブラリに追加されます。

<Elements xmlns="https://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="MyCustomRibbonTab"
    Location="CommandUI.Ribbon.ListView"
    RegistrationId="101" 
    RegistrationType="List">
      <CommandUIExtension>
        <CommandUIDefinitions>
          <CommandUIDefinition
            Location="Ribbon.Tabs._children">
            <Tab 
              Id="Ribbon.CustomTabExample" 
              Title="My Custom Tab" 
              Description="This holds my custom commands!" 
              Sequence="501">
            <Scaling
              Id="Ribbon.CustomTabExample.Scaling">
              <MaxSize
                Id="Ribbon.CustomTabExample.MaxSize" 
                GroupId="Ribbon.CustomTabExample.CustomGroupExample" 
                Size="OneLargeTwoMedium"/>
              <Scale 
                Id="Ribbon.CustomTabExample.Scaling.CustomTabScaling"
                GroupId="Ribbon.CustomTabExample.CustomGroupExample" 
                Size="OneLargeTwoMedium" />
            </Scaling>
            <Groups Id="Ribbon.CustomTabExample.Groups">
              <Group 
                Id="Ribbon.CustomTabExample.CustomGroupExample" 
                Description="This is a custom group!" 
                Title="Custom Group" 
                Sequence="52" 
                Template="Ribbon.Templates.CustomTemplateExample">
                <Controls Id="Ribbon.CustomTabExample.CustomGroupExample.Controls">
                  <Button 
                    Id="Ribbon.CustomTabExample.CustomGroupExample.HelloWorld" 
                    Command="CustomTabExample.HelloWorldCommand" 
                    Sequence="15" 
                    Description="Says hello to the World!" 
                    LabelText="Hello, World!" 
                    TemplateAlias="cust1"/>
                  <Button 
                    Id="Ribbon.CustomTabExample.CustomGroupExample.GoodbyeWorld" 
                    Command="CustomTabExample.GoodbyeWorldCommand" 
                    Sequence="17" 
                    Description="Says good-bye to the World!" 
                    LabelText="Good-bye, World!" 
                    TemplateAlias="cust2"/>
                  <Button 
                    Id="Ribbon.CustomTabExample.CustomGroupExample.LoveWorld" 
                    Command="CustomTabExample.LoveWorldCommand" 
                    Sequence="19" 
                    Description="Says I love the World!" 
                    LabelText="I love you, World!" 
                    TemplateAlias="cust3"/>
                </Controls>
              </Group>
            </Groups>
          </Tab>
        </CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.Templates._children">
          <GroupTemplate Id="Ribbon.Templates.CustomTemplateExample">
            <Layout 
              Title="OneLargeTwoMedium" 
              LayoutTitle="OneLargeTwoMedium">
              <Section Alignment="Top" Type="OneRow">
                <Row>
                  <ControlRef DisplayMode="Large" TemplateAlias="cust1" />
                </Row>
              </Section>
              <Section Alignment="Top" Type="TwoRow">
                <Row>
                  <ControlRef DisplayMode="Medium" TemplateAlias="cust2" />
                </Row>
                <Row>
                  <ControlRef DisplayMode="Medium" TemplateAlias="cust3" />
                </Row>
              </Section>
            </Layout>
          </GroupTemplate>
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
          Command="CustomTabExample.HelloWorldCommand" 
          CommandAction="javascript:alert('Hello, world!');" />
        <CommandUIHandler 
          Command="CustomTabExample.GoodbyeWorldCommand" 
          CommandAction="javascript:alert('Good-bye, world!');" />
        <CommandUIHandler 
          Command="CustomTabExample.LoveWorldCommand" 
          CommandAction="javascript:alert('I love you, world!');" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>