Friday, July 09, 2010

Default Values on Ribbons CommandAction SharePoint 2010

When you are configuring the Ribbons for SharePoint 2010, you will need to customize your Elements.XML file, there you can create new Ribbon options, you also need to associate some actions to this new options, normally this command can be use to call Client OM JavaScript or to redirect to pages, but when you redirect you can also add some Default parameters will help you work on the server side code, and make the changes you need.

< command="CustomCommand" commandaction="javascript:RediectPage('{SiteUrl}/_layouts/CustomPage.aspx?List={ListId}&ID={SelectedItemId}');">
Here the msdn Article ""
CommandAction- A script statement to execute when this handler is invoked. SharePoint Foundation calls the eval method, passing in the value of this attribute.
The value of the attribute can contain substitution tokens that will be transformed at rendering. The following tokens are recognized:
  • {ItemId} – ID (GUID) taken from the list view.
  • {ItemUrl} – Web-relative URL of the list item (Url).
  • {RecurrenceId} – ID of a recurrent item (RecurrenceID).
  • {SiteUrl} – The fully qualified URL to the site (Url).
  • {ListId} – ID (GUID) of the list (ID).
  • {ListUrlDir} – Server-relative URL of the site plus the list's folder.
  • {Source} – Fully qualified request URL.
  • {SelectedListId} – ID (GUID) of the list that is currently selected from a list view.
  • {SelectedItemId} – ID of the item that is currently selected from the list view.
For a SharePoint App that manage your ribbons can recomend the following link
SharePoint App Processlynx Custom Action and Ribbon Manager Launch
for the demo version in Office Store you can access the following link:
Processlynx Custom Action And Ribbon Manager Demo

Project Example:
Link CustomAction Project

Excellent articles about the Ribbons:
Customizing and Extending the SharePoint 2010 Server Ribbon
Work with the SharePoint 2010 Ribbon User Interface
How to: Modify the User Interface Using Custom Actions
How to: Add Actions to the User Interface
Custom Action Definition Schema
Module 10: Creating Dialogs and Ribbon Controls for SharePoint 2010
Adding a Custom Action to a SharePoint 2010 Display Form for List Items
Programmatically add ribbon custom action to an existing list
SharePoint Ribbon Visual Studio 2010 Template
SharePoint 2010 Site Actions Menu
Replacing a Button on the Server Ribbon for a Site Collection
Developing Page Components for the Server Ribbon 
Creating a Custom Web Part with a Contextual Tab 
If you need to define the Custom actions locations you can use the following ID
Default Custom Action Locations and IDs

How to hide Ribbons Controls:
Ribbons controls can be hide using code and associating the Controls ID of the Ribbons by code.

All the Ribbons Control ID reference are in the path:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\xml\CMDUI.XML"
SPRibbon ribbon = SPRibbon.GetCurrent(this.Page);

List of control ID for the Ribbons

or you can use XML to configure the Button
Removing a Button from the Server Ribbon

<-- Updated 12 December 2011 -->

No comments: