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 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?

share|improve this question
    

1 Answer 1

up vote 1 down vote accepted

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();
share|improve this answer

Your Answer

 
discard

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

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