This project is read-only.

How does it work?

Ribbon interface was introduced in SharePoint 2010 to help users quickly find commands that they need to complete tasks. It's like Microsoft Office system applications ribbon, all controls are organized in logical tabs and groups.
SharePoint allows developers to customize ribbon elements. There are two ways to do it:
  • Custom Actions (by using a feature);
  • Data Extensions supported by Microsoft.Web.CommandUI.Ribbon control.

Custom actions allow to extend SharePoint server ribbon declaratively using XML and JavaScript. Custom action must have binding to data context (List or Library, Content type, File extension or application where the file was created). You can't add custom ribbon elements to a page.

On the other hand RegisterDataExtension method allows to extend SharePoint ribbon programmatically. All you need is only instance of SPRibbon (actually you need instance of a page containig ribbon control):
var ribbon = SPRibbon.GetCurrent(Page);
// Register your data extension
ribbon.RegisterDataExtension(xmlNode, locationId);

QASPRibbon vs XML

To add custom SharePoint ribbon elements (tab, group, controls, etc.) by using RegisterDataExtension method we need a XML-declaration of used elements and template. QASPRibbon generates it! For example, instead XML declaration of a ribbon button like following:
<Button Id="Ribbon.TabId.GroupId.Controls.ButtonId" 
        Image16by16="{ImageUrl}" Image32by32="{ImageUrl}" 
        Image16by16Left="0" Image32by32Left="0" 
        Image16by16Top="0" Image32by32Top="0" 
        Command="Ribbon.TabId.GroupId.Controls.ButtonIdCommand" />

you've to have only a code definition of it:
var button = new RibbonButton("ButtonId", "ButtonTitle")
                       Image = Gallery2.GetExternalDataFromText,
                       OnClientClick = "GetExternalDataFromText()"

What does QASPRibbon do?

QASPRibbon generates ribbon XML (for controls and templates) and client-side code:
How does SharePoint Ribbon API work
Full size image

Using QASPRibbon allows you to focus on solution developing rather than the learning Server Ribbon schema.

See also

First Steps

Ribbon controls' hierarchy




Adding a custom tab to the SharePoint Rbbon

Last edited Aug 31, 2013 at 9:23 PM by VitalyZhukov, version 4


No comments yet.