Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a definition for a custom tab with a group with buttons for use within document libraries. One of the buttons is defined in another feature, this way i get a 'pluggable' structure for my custom tab. Buttons are made available based on the features activated (which contain the definitions for 'extra' buttons).

This system works fine, until I browse to a (sub)folder in the document library. The extra buttons is lost now, and i get an Javascript error. ("Sys.ArgumentNullException: Value cannot be null. Parameter name: element")

Even when placing all the 'CommandUIDefinition's in one file this occurs. It seems to be connected to the 'InitialTabId' parameter in the URL. When it is set to my new custom tab, the extra button is missing.

This works: Browse to documentlibrary, open a folder, switch to my customtab (all buttons are present)

This doesn't work: Browse to documentlibrary, switch to my customtab (all button presen), open a folder (now the button in the separate UIdefinition is missing).

Below is my Ribbon definition XML.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="Martijn.Ribbon"
    Location="CommandUI.Ribbon"
    RegistrationId="101"
    RegistrationType="List">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.LibraryContextualGroup._children"
          >
          <Tab
            Id="Martijn.Ribbon.Tab"
            Title="My Custom Tab"
            Description="This holds my custom commands!"
            Sequence="501">
            <Scaling
              Id="Martijn.Ribbon.Tab.Scaling">
              <MaxSize
                Id="Martijn.Ribbon.Tab.MaxSize"
                GroupId="Martijn.Ribbon.Tab.Group"
                Size="OneLargeTwoMedium"/>
              <Scale
                Id="Martijn.Ribbon.Tab.Scaling.CustomTabScaling"
                GroupId="Martijn.Ribbon.Tab.Group"
                Size="OneLargeTwoMedium" />
            </Scaling>
            <Groups Id="Martijn.Ribbon.Tab.Groups">
              <Group
                Id="Martijn.Ribbon.Tab.Group"
                Description="This is a custom group!"
                Title="Custom Group"
                Sequence="52"
                Template="Martijn.Ribbon.Templates.CustomTemplateExample">
                <Controls Id="Martijn.Ribbon.Tab.Group.Controls">
                  <Button
                    Id="Martijn.Ribbon.Tab.Group.HelloWorld"
                    Command="Martijn.Command.HelloWorldCommand"
                    Sequence="15"
                    Description="Says Hello to the World!"
                    LabelText="Hello, World!"
                    TemplateAlias="cust1"/>
                </Controls>
              </Group>
            </Groups>
          </Tab>
        </CommandUIDefinition>
        <CommandUIDefinition Location="Martijn.Ribbon.Tab.Group.Controls._children">

          <Button
            Id="Martijn.Ribbon.Tab.Group.GoodbyeWorld"
            Command="Martijn.Command.GoodbyeWorldCommand"
            Sequence="17"
            Description="Says Good-bye to the World!"
            LabelText="Good-bye, World!"
            TemplateAlias="cust2"/>
        </CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.Templates._children">
          <GroupTemplate Id="Martijn.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="Martijn.Command.HelloWorldCommand"
          CommandAction="javascript:alert('Hello, world!');" />
        <CommandUIHandler
          Command="Martijn.Command.GoodbyeWorldCommand"
          CommandAction="javascript:alert('Good-bye, world!');" />
        <CommandUIHandler
          Command="Martijn.Command.LoveWorldCommand"
          CommandAction="javascript:alert('I love you, world!');" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.