B
bparker
I'm trying to add an item to a sharepoint list using the Sharepoint
Lists web service. The code works fine when I set the credentials to
use DefaultCredentials. But I want to specify in code which user
account to use when calling the webservice b/c normal users do not have
access to write to this list. My code is as follows
Dim ListService as new WebService.Lists
ListService.Credentials = New System.Net.NetworkCredential("username",
"password", "domain")
ListService.Url = "http://myServerUrl/SubArea/_vti_bin/lists.asmx"
ListService.UpdateListItems("My List", camlBatch)
When I have the second line as ListService.Credentials =
System.Net.CredentialCache.DefaultCredentials it works fine. But when I
create a new credential using the same name/password as my current
logged in user it fails. I get the error "The request failed with HTTP
status 401: Unauthorized." for the UpdateListItems call.
I have found many cases where people can get this to work by passing
usernames/passwords and it doesn't work with default credentials, but
I'm the opposite, I can't get the call to work when passing a set of
credentials to the web service.
Anyone have any recommendations or troubleshooting ideas?
Thanks,
Brian
Lists web service. The code works fine when I set the credentials to
use DefaultCredentials. But I want to specify in code which user
account to use when calling the webservice b/c normal users do not have
access to write to this list. My code is as follows
Dim ListService as new WebService.Lists
ListService.Credentials = New System.Net.NetworkCredential("username",
"password", "domain")
ListService.Url = "http://myServerUrl/SubArea/_vti_bin/lists.asmx"
ListService.UpdateListItems("My List", camlBatch)
When I have the second line as ListService.Credentials =
System.Net.CredentialCache.DefaultCredentials it works fine. But when I
create a new credential using the same name/password as my current
logged in user it fails. I get the error "The request failed with HTTP
status 401: Unauthorized." for the UpdateListItems call.
I have found many cases where people can get this to work by passing
usernames/passwords and it doesn't work with default credentials, but
I'm the opposite, I can't get the call to work when passing a set of
credentials to the web service.
Anyone have any recommendations or troubleshooting ideas?
Thanks,
Brian