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.
You can use the SPRibbon.RegisterDataExtension() to insert Ribbon stuff. You're inserting XML though through this method.
The following links to an example using the RegisterDataExtension() method