I want to get clientcontext in a visual sandbox webpart.

How can I do it without providing any credentials for url, as webpart will be on home page. I don't want to provide any credentials either, just want it to work like, SPContext.current....

string siteURL=”http://localhost“;
ClientContext clientContext = new ClientContext(siteUrl);

1 Answer 1


Try to use: ClaimClientContext.GetAuthenticatedContext, instead of new ClientContext

  • I didn't get a chance to try it yet, but i will give you bounty Apr 12, 2014 at 8:43

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.