SharePoint URL Tokens

SharePoint 2013 supports the tokens listed in the following tables for use in apps for SharePoint. The StartPage column specifies whether the token can be used in the StartPage element of an app manifest. The Custom Action column specifies whether the token can be used in the URL of a custom action on a host web. The App Part column specifies whether the token can be used in the Src property of the app part.
 
Tokens that can be used at the beginning of a URL in an app for SharePoint.

TokenResolves toStart PageCustom ActionApp PartRemarks
~appWebUrlThe URL of the app web of an app for SharePoint.YesYesYesShould be used only outside an app web. Within the app web itself, use ~site for the URL of the app web.
~controlTemplatesThe URL of the ControlTemplates virtual folder for the current website.NoNoNo 
~hostUrlThe URL of the host web.NoNoYes 
~hostLogoUrlThe URL of the logo of the host web.NoNoNo 
~layoutsThe URL of the Layouts virtual folder for the current website.NoNoNo 
~remoteAppUrlThe URL of a remote web application in an app for SharePoint.YesYes, in the host web, but No in the app web.YesIf you are not using Visual Studio and Microsoft Office Developer Tools to develop your app for SharePoint, you can use ~remoteAppUrl only in the StartPage URL of autohosted apps. However, when you are using Visual Studio and the tools, you can use this token for any provider-hosted app and it is resolved when Visual Studio packages the app. In this usage, it is really more of a Visual Studio token than a SharePoint token. It can be used outside the app manifest for both provider-hosted and autohosted apps.
~siteThe URL of the current website.NoNoYes 
~sitecollectionThe URL of the parent site collection of the current website.NoNoYes 

Except where indicated otherwise, none of the tokens in the next table can be used in the path portion of the Src property value of the app part. The App Part column refers to their use in the query string portion of the value.

Tokens that can be used inside a URL,

TokenResolves toStart PageCustom ActionApp PartRemarks
{AppContextToken}The OAuth context token for the app.NoNoNo 
{AppWebUrl}The URL of the app web in an app for SharePoint.YesYesYesThis token should be used only outside an app web. Within the app web itself, use {Site} for the URL of the app web.
{ClientTag}The client cache control number (client tag) for the current website.YesYesYes 
{HostLogoUrl}The logo for the host web of an app for SharePoint.YesYesYes 
{HostTitle}The title of the host web of an app for SharePoint.YesYesYes 
{HostUrl}The URL of the host web of an app for SharePoint.YesYesYes 
{ItemId}The ID of an item in a list or library (an integer).NoYesNo 
{ItemUrl}The URL of the item being acted upon.NoYesNo 
{Language}The current language/culture of the host web of an app for SharePoint.YesYesYes 
{ListId}The ID of the current list (a GUID).NoYesNo 
{ProductNumber}The full build version number of the SharePoint farm.YesYesYesAn example value is “15.0.4433.1011”.
{RecurrenceId}The recurrence index of a recurring event.NoYesNoThis token is not supported for use in the context menus of list items.
{RemoteAppUrl}The URL of a remote web application in an app for SharePoint.YesYesYes 
{Site}The URL of the current website.NoYesYes 
{SiteCollection}The URL of the parent site of the current website.NoYesYes 
{SiteUrl}The URL of the current website.NoYesNo 
{Source}The HTTP Request URL.NoYesNo 
{StandardTokens}See Remarks.YesYesYesThis combines five other tokens. It initially resolves to SPHostUrl={HostUrl}&SPAppWebUrl={AppWebUrl}&SPLanguage={Language}&SPClientTag={ClientTag}&SPProductNumber={ProductNumber}. Then each of these tokens resolves. If there is no app web, the portion &SPAppWebUrl={AppWebUrl} is not present.