简体   繁体   中英

The remote server returned an error: (401) Unauthorized sharepoint

Here is my scenario:

I have my Sharepoint server hosted on Domain A and I have my machine on Domain B . There is not any trust between Domain A and Domain B .

I am trying to access the Sharepoint Document library from my machine to Sharepoint server which is on Domain A.

Now when i used this code:

ClientContext clientContext = new ClientContext(siteURL);
clientContext.Credentials = new System.Net.NetworkCredential(username,password,domain);
clientContext.ExecuteQuery();

I got the following error:

The remote server returned an error: (401) Unauthorized 

I want to know if it is possible to access SharePoint document library accross the domain without having trust between each other? The only solution I can think of is my machine should be on the Domain A.

Update

I transfered my machine on Domain A that is on that domain where sharepoint server is installed. Still same error getting at clientContext.ExecuteQuery(); . I dont know why pelase help.

If the domains don't trust each other, it means that SharePoint box from domain A cannot retrieve account properties from domain's B domain controller. When you access a particular SharePoint site for the first time, the "Users" list is populated with a new entry - your local user data (user name, SID, display name, email, SIP address) at that SharePoint site. To fill this information, SharePoint tries to query your domain controller (which, in your scenario, cannot be done). So, the answer is - it won't work this way.

SharePoint 2010 Client Object Model - Proxy Authentication Required

This may be of help.

401 Unauthorized could simply be that your credentials and domain are incorrect so also check these. Also check that these have access to the site. I know it's basic but i have done it a few times as others have removed privlages without me knowing!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM