What are the functions of Query String? I just want to know: What does it do & Why it is needed? If I remove it, then what will I miss? enter image description here


Information in the Query String is one of a few techniques for persisting information to subsequent HTTP requests. HTTP does not have any way to remember who a user is, or why they are making a request unless the information is provided to the server as part of the request (that is to say, HTTP does not remember state, or is stateless). Passing information via the query string is one technique to overcome this behavior.

The SharePoint App model uses them for this purpose as well. {StandardTokens}, for example, provides a SharePoint app with the Host URL, the App web's URL, the language of the referring SharePoint site, the client cache control number (a way to look up information using another method for persisting data between requests), as well as the full build version of the SharePoint farm.

Information such as this is very important to your SharePoint App, regardless of where it is hosted. Common uses include telling your App where to send queries for information that live in the host web (need the host web URL to do that), providing navigation options so your users can get back to the SharePoint site they came from, fetching styling information to match the referring SharePoint environment, and much more.

Specifying which tokens to include in the App Manifest (like in your screenshot) simply handles all of the details of making sure links to your App have all of this information in them for you -- that way your App is ready to run when a user visits it.

| improve this answer | |

The tokens can be used in URLs in a wide variety of situations in development of apps for SharePoint, such as in Custom Actions and in links on custom pages. In some contexts, some of these tokens cannot be used. Three of the most important places where only a restricted list of tokens can be used are the start page of an app, a custom action on the host web, and the Src property of an app part.

Tokens that can be used at the beginning of a URL in an app for SharePoint

  1. ~appWebUrl
  2. ~controlTemplates
  3. ~hostUrl
  4. ~hostLogoUrl
  5. ~layouts
  6. ~remoteAppUrl
  7. ~site
  8. ~sitecollection

Tokens that can be used inside a URL

  1. {AppContextToken}
  2. {AppWebUrl}
  3. {ClientTag}
  4. {HostLogoUrl}
  5. {HostTitle}
  6. {HostUrl}
  7. {ItemId}
  8. {ItemUrl}
  9. {Language}
  10. {ListId}
  11. {ProductNumber}
  12. {RecurrenceId}
  13. {RemoteAppUrl}
  14. {Site}
  15. {SiteCollection}
  16. {SiteUrl}
  17. {Source}
  18. {StandardTokens}


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.