Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

Provider Hosted App note getting context token

$
0
0

Hi,

Here's a sample code that we are using for a provider hosted app. Somehow the contextToken is coming as null and hence not able to pull information from SP list. Please suggest.

try
               {
                   SharePointContextToken contextToken;
                   Uri sharepointUrl;
                   string accessToken;
                   TokenHelper.TrustAllCertificates();
                   string contextTokenString = TokenHelper.GetContextTokenFromRequest(Request);
                   if (contextTokenString != null)
                   {
                       contextToken = TokenHelper.ReadAndValidateContextToken(contextTokenString, Request.Url.Authority);
                       sharepointUrl = new Uri(Request.QueryString["SPHostUrl"]);
                       accessToken = TokenHelper.GetAccessToken(contextToken, sharepointUrl.Authority).AccessToken;
                       ClientContext context = TokenHelper.GetClientContextWithAccessToken(sharepointUrl.ToString(), accessToken);


SharePoint Architect


Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>