0

NOTE: I know this question has been asked before but the answers shown at Buttons not appearing in custom ribbon group do not seem to explain fully how to solve the issue. I added a GroupTemplate but have no idea where to add the Scaling element. So i will ask the question again and hopefully will get help:

I am trying to put a custom Group + button onto the ribbon of the NewForm.aspx for only lists derived from a custom list definition. The following is what i have come up with. The problem is that although the group appears where you would expect on the ribbon the button is missing. Can anyone help me figure out what i'm doing wrong?

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="SelectPictureButton"
    RegistrationType="List"
    RegistrationId="10001"
    Location="CommandUI.Ribbon.NewForm"
    Sequence="0"
    Rights="">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Templates._children">
          <GroupTemplate Id="Ribbon.Templates.CustomTemplate">
            <Layout Title="Large">
              <OverflowSection Type="OneRow" TemplateAlias="o1" DisplayMode="Large"/>
            </Layout>
            <Layout Title="Medium">
              <OverflowSection Type="ThreeRow" TemplateAlias="o1" DisplayMode="Medium"/>
            </Layout>
            <Layout Title="MediumTwoRow">
              <OverflowSection Type="TwoRow" TemplateAlias="o1" DisplayMode="Medium" />
            </Layout>
            <Layout Title="Small">
              <OverflowSection Type="ThreeRow" TemplateAlias="o1" DisplayMode="Small" />
            </Layout>
            <Layout Title="Popup" LayoutTitle="Large" />
          </GroupTemplate>
        </CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.ListForm.Edit.Groups._children">
          <Group Id="Ribbon.ListForm.Edit.Groups.CustomGroup"
            Sequence="100" Title="Actions"
            Description="Custom Action Group"
            Template="Ribbon.Templates.CustomTemplate">
            <Controls Id="Ribbon.ListForm.Edit.Groups.CustomGroup.Controls">
              <Button
                Id="Ribbon.ListForm.Edit.Groups.CustomGroup.Controls.Button"
                Alt="Select Image"
                Sequence="1"
                Image32by32="/_layouts/images/PicturePicker/image_32.png"
                Command="SelectImageCommand"
                LabelText="Select Image"
                TemplateAlias="o1"
                CommandType="General"/>
            </Controls>
          </Group>
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
         Command="SelectImageCommand"
         CommandAction="javascript:alert('Hello World');" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>
0

Finally had the right google search and came across the solution to me problem. Was missing the MaxSize element. Also use their GroupTemplate. Here is the working version.

    <?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="SelectPictureButton"
    RegistrationType="List"
    RegistrationId="10001"
    Location="CommandUI.Ribbon.NewForm"
    Sequence="0"
    Rights="">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Templates._children">
          <GroupTemplate Id="Ribbon.Templates.CustomTemplate">
            <Layout Title="NewGroupInExistingTabOneLarge" LayoutTitle="NewGroupInExistingTabOneLarge">
              <Section Alignment="Top" Type="OneRow">
                <Row>
                  <ControlRef DisplayMode="Large" TemplateAlias="Button1" />                    
                </Row>
              </Section>
            </Layout>
          </GroupTemplate>
        </CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.ListForm.Edit.Scaling._children">
          <MaxSize
            Id="Ribbon.ListForm.Edit.MaxSize"
            Sequence="15"
            GroupId="Ribbon.ListForm.Edit.Groups.CustomGroup"
            Size="NewGroupInExistingTabOneLarge" />          
        </CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.ListForm.Edit.Groups._children">
          <Group Id="Ribbon.ListForm.Edit.Groups.CustomGroup"
            Sequence="100" Title="Actions"
            Description="Custom Action Group"
            Template="Ribbon.Templates.CustomTemplate">
            <Controls Id="Ribbon.ListForm.Edit.Groups.CustomGroup.Controls">
              <Button
                Id="Ribbon.ListForm.Edit.Groups.CustomGroup.Controls.Button"
                Alt="Select Image"
                Sequence="1"
                Image32by32="/_layouts/images/PicturePicker/image_32.png"
                Command="SelectImageCommand"
                LabelText="Select Image"
                TemplateAlias="Button1"
                CommandType="General"/>
            </Controls>
          </Group>
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
         Command="SelectImageCommand"
         CommandAction="javascript:alert('Hello World');" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.