You must Sign In to post a response.
  • Category: Sharepoint

    Shaepoint App Read Query string from host web


    I have a App in a SharePoint Page. The page URL is having query string. How can i read query string in Sharepoint hosted App.

    if u have any thoughts, please share me.

    Thanks in advance.
  • #748128
    check below code if it helps or pass me your code. will have a look on it.

    // Set up SharePoint Context
    Uri sharePointUrl = MyApp.UrlHelper.GetSharePointUrl(Request.QueryString);
    MyApp.OAuthTokenPair tokenPair = MyApp.TokenDictionary.GetOAuthTokenPairFromContextToken(null, sharePointUrl.Authority, Request.Url.Authority, Request.Cookies, Response.Cookies);
    string accessToken = (tokenPair != null ? tokenPair.AccessToken : "");

    // Get SharePoint client context
    Microsoft.SharePoint.Client.ClientContext clientContext = MyApp.TokenHelper.GetClientContextWithAccessToken(sharePointUrl.ToString(), accessToken);

    // Load Query
    Microsoft.SharePoint.Client.Web web = clientContext.Web;


  • Sign In to post your comments