I am trying to access the Root site list using the sub site client context. But when I try to execute the clientcontext it gives Access Denied error.

I tried to create new clientcontext by passing the accessToken as well but no success. (Referred: This)

Below is the code:

string siteUrl = clientContext.Site.Url;
Uri webUri = new Uri(siteUrl);
string realm = TokenHelper.GetRealmFromTargetUrl(webUri);
string accessToken = TokenHelper.GetAppOnlyAccessToken(TokenHelper.SharePointPrincipal, webUri.Authority, realm).AccessToken;
using (var cc = TokenHelper.GetClientContextWithAccessToken(siteUrl, accessToken))

Here, clientContext is the context of Sub-Site and cc is the context of Root site.

How can I access the cc using clientContext?

1 Answer 1


Found a solution!!

We can access the Root site lists from subsite using below.


No need to create a new context of the Root site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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