1

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? – Denis Molodtsov Sep 6 '17 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# – John Zachariah Sep 6 '17 at 13:32
1

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, 
PASSWORD.GetSecureString()); 
Web web = context.Web; context.Load(web); 
context.ExecuteQuery(); 
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?? – John Zachariah Sep 6 '17 at 14:51
  • It should work. if you use credentials. What error do you get? – Denis Molodtsov Sep 6 '17 at 18:15
  • If I use credentials from ABC.. I get access forbidden exception – John Zachariah Sep 6 '17 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) – Denis Molodtsov Sep 6 '17 at 18:32
  • When I access via browser I can access but not via code. It does have access – John Zachariah Sep 6 '17 at 18:34
1

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!

https://blogs.msdn.microsoft.com/besidethepoint/2010/05/08/double-hop-authentication-why-ntlm-fails-and-kerberos-works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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