Tuesday, July 17, 2012

Customize SharePoint 2010 OOB Ribbons and SharePoint Dialogs

In SP 2010, the UI has been changed and implemented the Ribbon concept looking like MS office 2007, and implemented SharePoint Dialogs for manipulations like changing the list names i.e. edit form, view form, new form aspx pages are now changed as Show Dialog pages using Client object model to avoid the post backs.

Below code snippet is a simple example of custom ribbon buttons and Dialog boxes.

In Custom ribbon development, we need to write a code in elements.xml as we have done in SP 2007 custom actions.

The main element is Location of custom action i.e. where we need to add our custom ribbon controls, this means for example if we want to show our custom ribbon controls when the list view web part is present then we need to give the value as shown in below table.

Value Description
CommandUI.Ribbon Customization appears everywhere for the specified
RegistrationId.

CommandUI.Ribbon.ListView Customization appears when the list view Web Part is
present.

CommandUI.Ribbon.EditForm Customization appears on the edit form.

CommandUI.Ribbon.NewForm Customization appears on the new form.

CommandUI.Ribbon.DisplayForm Customization appears on the display form.


The next important one is, Location of ribbon controls, before discussing about this we need to discuss ribbon tabs, i.e. for lists there are 2 tabs Items and Lists tabs, in that tabs there are few groups which groups the controls based on the behavior suppose in Lists tab View and Settings groups for views (Default view, All Items view) and settings (list settings).

Now, what we need to do is, we can place our ribbon controls in above groups by specifying the location value as shown in below sample.

Suppose for Documents tab->Manage group-> we need to specify the location as

Ribbon.Documents.Manage.Controls._children

For lists->Settings group->Ribbon.List.Settings.Controls._children

Here in above example, Libraries/Documents/List/ListItem represents (ribbon controls on Document or list or Item) TAB, Settings represents Groups controls are buttons, drop downs etc…


These are the basic way to implement the ribbon button controls, we can customize the tabs and we can implement new menus and lot of stuff using these custom action and we can write the Client Object model.

Note: We can see all existed groups and locations of ribbon in the below specified file path (existed in 14 hive)

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\XML\CMDUI.xml

or we can find out from Microsoft SDK.
Default Ribbon Customization Locations

The best blog for custom ribbon controls

No comments:

Post a Comment