A long time ago, I had blogged about replaceable parameters that are available for use in Standard SharePoint solution packages oriented code.
With the introduction of apps, we have a slew of new replaceable parameters at our disposal. These can be split into two parts,
- Those that are URL tokens, i.e. to the left of the Query String, and
- Those that can be part of the Query String.
Additionally, their usage is restricted to whether they are being run in Full Page, Custom Action or as a Client WebPart
So the tokens that can be added as a part of the URL are,
|
Token |
Description |
Full Page |
Custom Action |
Client WebPart |
|
~appWebUrl |
The URL of the app web of an app for SharePoint. This token should be used only outside an app web. Within the app web itself, use ~site for the URL of the app web. |
Yes |
Yes |
Yes |
|
~controlTemplates |
The URL of the ControlTemplates virtual folder for the current website. |
No |
No |
No |
|
~hostUrl |
The URL of the host web. |
No |
No |
Yes |
|
~hostLogoUrl |
The URL of the logo of the host web. |
No |
No |
No |
|
~layouts |
The URL of the Layouts virtual folder for the current website. |
No |
No |
No |
|
~remoteAppUrl |
The URL of a remote web application in an app for SharePoint. This token can be used in the app manifest only for autohosted apps. For provider-hosted apps, you must specify the URL. It can be used outside the app manifest for both provider-hosted and autohosted apps. |
Yes |
Yes |
Yes |
|
~site |
The URL of the current website. |
No |
No |
Yes |
|
~sitecollection |
The URL of the parent site collection of the current website. |
No |
No |
Yes |
And the Tokens that can be part of the Query String are as below,
|
Token |
Description |
Full Page |
Custom Action |
Client WebPart |
|
{AppContextToken} |
The OAuth context token for the app. |
No |
No |
No |
|
{AppWebUrl} |
This token should be used only outside an app web. Within the app web itself, use {Site} for the URL of the app web. |
Yes |
Yes |
Yes |
|
{ClientTag} |
The client cache control number (client tag) for the current website. |
Yes |
Yes |
Yes |
|
{HostLogoUrl} |
The logo for the host web of an app for SharePoint. |
Yes |
Yes |
Yes |
|
{HostTitle} |
The title of the host web of an app for SharePoint. |
Yes |
Yes |
Yes |
|
{HostUrl} |
The URL of the host web of an app for SharePoint. |
Yes |
Yes |
Yes |
|
{ItemId} |
The ID of an item in a list or library (an integer). |
No |
Yes |
No |
|
{ItemUrl} |
The URL of the item being acted upon. |
No |
Yes |
No |
|
{Language} |
This token can be used in an app part, specifically the Src property, only if it appears in the path part of the value, not the query string part. |
Yes |
Yes |
Yes. |
|
{ListId} |
The ID of the current list (a GUID). |
No |
Yes |
No |
|
{ProductNumber} |
The full build version number of the SharePoint farm. |
Yes |
Yes |
Yes |
|
{RecurrenceId} |
This token is not supported for use in the context menus of list items. |
No |
Yes |
No |
|
{RemoteAppUrl} |
The URL of a remote web application in an app for SharePoint. |
Yes |
Yes |
Yes |
|
{Site} |
The URL of the current website. |
No |
Yes |
Yes |
|
{SiteCollection} |
The URL of the parent site of the current website. |
No |
Yes |
Yes |
|
{SiteUrl} |
The URL of the current website. |
No |
Yes |
No |
|
{Source} |
The HTTP Request URL. |
No |
Yes |
No |
|
{StandardTokens} |
This combines five other tokens. SPHostUrl, SPAppWebUrl, SPLanguage, SPClientTag and SPProductNumber. If there is no app web, the portion AppWebUrl is not present. |
Yes |
Yes |
Yes |
Enjoy & Happy SharePointing.