I have a question regarding Custom actions:
Basically what I would like to have is a custom action to shown only when the
This action is located in the ribbon.
Any idea on how I can do that?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
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();