I am trying to call a SharePoint Lists service to get list definition and data. The SharePoint site is my companies but I have no control over it. Here is all I know about the server's security:
Server is HTTPS:// Server accepts Windows Active Directory credentials when logging in...
I have tried Basic, Digest, CredentialCache, just NetworkCredential, UnsafeAuthenticatedConnectionSharing, UseDefaultCredentials, PreAuthenticate... not sure what the proper config is...
The error I receive is HTTP 401 Unauthorized.
Uri url = new Uri(baseAddress + "/_vti_bin/Lists.asmx", UriKind.Absolute);
Lists.Lists client = new Lists.Lists();
// sometimes works
CredentialCache cache = new CredentialCache();
cache.Add(url, "NTLM", new NetworkCredential(context.UserName, context.Password, context.Domain));
client.UseDefaultCredentials = false;
client.Credentials = CredentialCache.DefaultCredentials;
// doesn't work ever
//client.Credentials = new NetworkCredential(context.UserName, context.Password, context.Domain);
//client.PreAuthenticate = true;
client.UnsafeAuthenticatedConnectionSharing = true;
client.Url = url.AbsoluteUri;
listData = client.GetList(listName).OuterXml;