Saturday, May 9, 2009

Sharepoint - UrlAction Tokens Of The CustomAction Feature

I was looking today for the complete list of tokens that can be used in the UrlAction element when building a CustomAction feature but I couldn’t find much. So I decided to put together this blog entry to help other people that may be looking for the same thing.

As you know some tokens can be used when specifying the Url of the custom action: 

<UrlActionUrl=”~site/_layouts/ItemAudit.aspx?ID={ItemId}&List={ListId}”/>

Those token will be replaced by SharePoint at runtime with values derived from the current context. To get the complete list we just need to find the function that does the replacement. Luckily this function is in the .NET libraries of SharePoint and can be disassembled with Reflector. So here is the complete list of the tokens:

TokenReplaced By
~site/SPContext.Current.Web.ServerRelativeUrl
~sitecollection/SPContext.Current.Site.ServerRelativeUrl
{ItemId}item.ID.ToString()
{ItemUrl}item.Url
{SiteUrl}web.Url
{ListId}list.ID.ToString(“B”)
{RecurrenceId}

For information check this nice  link http://hristopavlov.wordpress.com/2008/12/08/urlaction-tokens-of-the-customaction-feature/

item.RecurrenceID