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'm trying to register a custom action on a site collection that adds a button to the SharePoint ribbon. I want to do this using the object model and not declaratively in XML. Does anyone know of this is even possible? I've been looking at SPRibbonButton but cannot figure a way to achieve this.

share|improve this question
@orl78: Remember to mark questions as answered if you have an answer that works for you. This rewards those that help you out. Thanks! –  Alex Angas Sep 1 '10 at 7:19

2 Answers 2

You can use the SPRibbon.RegisterDataExtension() to insert Ribbon stuff. You're inserting XML though through this method.

share|improve this answer
Thanks Wictor, yeah I had seen this method and thought it may be the solution. I was hoping though that there may be a way to set properties on an spribbonbutton object and then call .add() or similar. Thx again –  Anonymous Aug 28 '10 at 19:50

The following links to an example using the RegisterDataExtension() method


share|improve this answer

Your Answer


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