1

I have a question regarding Custom actions:

Basically what I would like to have is a custom action to shown only when the list.RootFolder.Properties.ContainsKey().

This action is located in the ribbon.

Any idea on how I can do that?

1

1 Answer 1

1

To answer my own question, I found a solution by creating custom action automatically when my feature by anyway is activated.

I used SPUserCustomAction, here is a piece of code for someone who will be interested, the code is shortned, but you will see the idea:

 SPUserCustomAction action = list.UserCustomActions.Add();
                action.Title = "";
                action.Description = "";
                action.Location = "CommandUI.Ribbon";
                action.Sequence = 10000;

                action.CommandUIExtension = @"<CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="">
          <Button />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler />
      </CommandUIHandlers>
    </CommandUIExtension>";
                action.Update();

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.