http://msdn.microsoft.com/en-us/library/ff458385.aspx:
{SiteUrl} – The fully qualified URL to the site (Url).
The SharePoint code proves it - here's the SPCustomActionElement.ReplaceUrlTokens
method:
internal static string ReplaceUrlTokens(string urlAction, SPWeb web, SPList list, SPListItem item)
{
if (string.IsNullOrEmpty(urlAction))
return urlAction;
if (item != null)
{
string newValue1 = item.ID.ToString((IFormatProvider) CultureInfo.InvariantCulture);
if (list.HasExternalDataSource)
newValue1 = ((SPItem) item)["BdcIdentity"] as string;
urlAction = urlAction.Replace("{ItemId}", newValue1);
urlAction = urlAction.Replace("{ItemUrl}", item.Url);
string newValue2 = newValue1;
if (!string.IsNullOrEmpty(item.RecurrenceID))
newValue2 = item.RecurrenceID;
urlAction = urlAction.Replace("{RecurrenceId}", newValue2);
}
if (web != null)
urlAction = urlAction.Replace("{SiteUrl}", web.Url);
if (list != null)
{
urlAction = urlAction.Replace("{ListId}", list.ID.ToString("B"));
if (list.RootFolder != null)
urlAction = urlAction.Replace("{ListUrlDir}", list.RootFolder.Url);
}
HttpContext current = HttpContext.Current;
if (current != null && current.Request != null)
{
string rawUrl = current.Request.RawUrl;
Uri contextUri = SPAlternateUrl.ContextUri;
if (!string.IsNullOrEmpty(rawUrl) && (Uri) null != contextUri)
{
string keyOrValueToEncode = SPUtility.StsStartsWith(rawUrl, "/") ? contextUri.GetLeftPart(UriPartial.Authority) + rawUrl : contextUri.GetLeftPart(UriPartial.Authority) + "/" + rawUrl;
urlAction = urlAction.Replace("{Source}", SPHttpUtility.UrlKeyValueEncode(keyOrValueToEncode));
}
}
urlAction = SPUtility.GetServerRelativeUrlFromPrefixedUrl(urlAction);
return urlAction;
}
UPDATE:
Finally I've made a test myself. Here's the definition of my custom action handler:
<CommandUIHandler
Command="NewRibbonButtonCommand"
CommandAction="javascript:alert('Hello, world, \'{SiteUrl}\'');" />
</CommandUIHandlers>
And here's the result message:
--------------------------- Message from webpage
Hello, world, 'http://testportal/innersite'
--------------------------- OK
So the {SiteUrl} url token is the absolute path to the current SPWeb
.