Different types of Tokens available for SharePoint 2013 URLs

Ashok Raja
 
Solutions Architect
November 25, 2012
 
Rate this article
 
Views
675

SharePoint 2013 URLs and SharePoint 2013 Napa Apps URLs accepts different tokens while parsing URLs. These tokens are resolved during runtime and embedded into the URLs in which they are called.

These tokens can be classified into 2 different categories as tokens at the beginning and tokens in the middle of URL. The below are the tokens that are common for both normal SharePoint Apps and SharePoint Napa Apps.

1.Tokens at the beginning of URL

1.1   ~controlTemplates  (points to control template folder in 15 hive)
1.2    ~layouts (points to _layouts folder in 15 hive)
1.3    ~site (points to current website)
1.4    ~sitecollection (points to parent site of current website)

2.Tokens inside the URL

2.1   {ItemId} (refers to  id of an list item)
2.2   {ItemUrl} (refers to an Item Url is a list )
2.3   {ListId} (referrers to List id)
2.4   {RecurrenceId} (refers to index of an recurring event)
2.5   {Site} (refers to current site)
2.6   {SiteCollection} (refers to parent of current site)
2.7   {SiteUrl} (refers to URL of current site)

While referring assets placed in layouts folder or doc libs, use site collection tokens instead of site tokens. Site tokens are resolved in a different manner when compared to site collection tokens.  For example, if a CSS file is referred via site token in a page which is located inside a doc lib “Site Pages”, the resolved URL includes the “Site pages” as well.  To avoid these types of issues, it’s better to refer scripts, styles and images via site collection token.

To learn more on this topic refer this link at MSDN

Likewise the Napa Apps in SharePoint 2013 also uses different set of tokens apart from the list of tokens mentioned above. Out of which, {StandardTokens} is a token which is commonly referred by default in every App. It’s a combination of {HostUrl}, {AppWebUrl} and {Language} tokens.

To learn more about tokens available for SharePoint 2013 napa Apps checkout this link in MSDN

Category : Tips

Author Info

Ashok Raja
 
Solutions Architect
 
Rate this article
 
I am Ashok Raja, Share Point Consultant and Architect based out of Chennai, India. ...read more
 

Leave a comment