We have different domain xyz.com and we can browse the contents of xyz.com sharepoint site using ADFS of abc.com using Single sign-on.

The Problem is how to get access the sharepoint list in xyz.com when we have only abc.com access?.

How to retrieve the list item in xyz.com using this CSOM based model with above said abc.com user?

  • Why does it matter if it's another domain? Are you talking about C# or JavaScript? Sep 6, 2017 at 13:30
  • Because ,getting access forbidden error. Not sure how to get successfully retrieve list items when the contents in another domain (in the same domain can access the contents and display using c#(CSOM)), not sure why and how to proceed. Using CSOM model , C# Sep 6, 2017 at 13:32

2 Answers 2


You can create a new CSOM context by providing credentials:

var clientContext = new ClientContext(SITE_URL);
clientContext.AuthenticationMode = ClientAuthenticationMode.Default; 
clientContext.Credentials = new DefaultNetworkCredential(USER, 
Web web = context.Web; context.Load(web); 
Console.WriteLine("Connected to " + web.Title + " site");

I'm not sure if there are any other good options in case of SP2010

  • This does not work still. Tried default mode too. Any alternative?? Sep 6, 2017 at 14:51
  • It should work. if you use credentials. What error do you get? Sep 6, 2017 at 18:15
  • If I use credentials from ABC.. I get access forbidden exception Sep 6, 2017 at 18:21
  • I've just reread your question again... so you are saying that you don't have access to a site "xyz.com". And you want to get access to this site somehow, without having permissions to it? It does not make any sense to me. Can you access xyz.com via the browser? If you do - then the same credentials can be used to access it from code using DefaultNetworkCredential(Login,password) Sep 6, 2017 at 18:32
  • When I access via browser I can access but not via code. It does have access Sep 6, 2017 at 18:34

I'm assuming you're writing web parts deployed to the abc.com farm. If so, you're probably experiencing a classic double-hop issue. The code on abc does not access xyz using the current abc user's login, it does so using the app pool identity of the abc web application.

If you have very basic security requirement, you can add grant that identity access to xyz and you might get some data. If you need to maintain the abc user's security context, you're going to have to implement some sort of pass-through mechanism like Kerberos. Good luck!


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.