SharePoint Custom Web Services Consuming Issues - HTTP 401: Unauthorized

I have a custom web service deployed in WSS 3. It has two web methods.

The former returns the version of the loaded assembly without any call to SharePoint objects. The second one returns some basic information about the library, for example:

var spLibrary = [find library logic];
return spLibrary.Name+"@"+spLibrary.Url;

      

In a client application, I have something like the following:

var service = new WebService1();
service.Url = [url];
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

service.Method1();
service.Method2();

      

When the client application runs on the machine where SharePoint is deployed, everything works fine.

When the client application is launched on a remote machine (but under the same user), the first method still works, and the second throws System.Net.WebException: HTTP 401: Unauthorized.

I tried to set credentials manually (service.Credentials = new System.Net.NetworkCredential (login, password, domain);), but that doesn't help.

I tried to call the built-in SharePoint web services using a similar scenario and they work very well: Sorry for the mistake ... Some methods did not work fine without proper privileges.

var service = new GroupsService(); 
service.Url = [url]; 
service.Credentials = System.Net.CredentialCache.DefaultCredentials; 

service.SomeMethod();

      

+2


source to share


1 answer


The problem was solved. The user whose account was used to interact with sharepoint was given site collection administrator rights and everything worked fine.

This is not a double permutation problem.



Hope this experience helps someone else.

Here's a link to the MSDN forums thread.

+3


source







All Articles