Tuesday, April 13, 2010

List of SharePoint URL tokens


URLs and tokens in SharePoint 2013

For SP2007:

Following is a list of tokens available in Sharepoint to use in your URLs. Be aware that Sharepoint only replaces the value of a token once for a given string, so if you have used the same token twice, second occurrence will not be replaced by the token value:

~site – Web site (SPWeb) relative link.

~sitecollection – site collection (SPSite) relative link.

In addition, you can use the following tokens within a URL:

{ItemId} – Integer ID that represents the item within a list.

{ItemUrl} – URL of the item being acted upon. Only work for documents in libraries. [Not functional in Beta 2]

{ListId} - GUID that represents the list.

{SiteUrl} – URL of the Web site (SPWeb).

{RecurrenceId} – Recurrence index. This token is not supported for use in the context menus of list items.

P.S. I have noticed whenever I used ~site in the xslt web part, SharePoint generates the absolute link with ~site in the middle which brakes the link all the time). My solution - don't use the token at all and place only a relative link. Ex: to show link to view AllItems on the list with Name "Discussions"- "Lists/Discussions/AllItems.aspx