I have a sharepoint site (e.g. https://site1.sharepoint.com/). The Visual Studio generates code to get client context for current site. I need to get the client context from external site (e.g. https://site2.sharepoint.com/) by URL. I need to open login page for second site (probably using OAuth protocol), then create client context and use it with the first client context (to copy the data between them). How I can do that? Is it possible?

1 Answer 1


Provided that you're able to authenticate to the site, it is doable.

Here's an example of obtaining the client context.

ClientContext context = new ClientContext("http://yoursite");
List list = context.Web.Lists.GetByTitle("Tasks");

Read more here: http://www.codeproject.com/Articles/399156/SharePoint-Client-Object-Model-Introduction

  • Thank you for your reply. But your code works only for current site. I can not find information about getting context from another site, that's why I asked the question here.
    – okyrylchuk
    Feb 4, 2015 at 8:45
  • What errors are you getting?
    – jpollar
    Feb 4, 2015 at 14:37

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.