I have a process that runs every 5 minutes to get some information from
a SharePoint list.
It very inconsistently gives me a 401 error Unauthorized.
The console program is running on a separate server (not running on the
SharePoint server).
Code snippet for GetWeb:
SharePointSiteDataWebService.SiteData siteData = new
SharePointSiteDataWebService.SiteData();
siteData.Url = "http://" + _spServer + _listPath +
"_vti_bin/SiteData.asmx";
// the line below was the original code but got the 401 error
/////siteData.Credentials = new NetworkCredential(_uid, _pwd, _dom);
CredentialCache cache = new CredentialCache();
// the 2nd parameter below was "Negotiate", changed it to "Ntlm" - still
getting sporadic 401 error
cache.Add( new Uri( siteData.Url ), "Ntlm", new NetworkCredential( _uid,
_pwd, _dom ) );
siteData.Credentials = cache;
SharePointSiteDataWebService._sWebMetadata siteMData = null;
SharePointSiteDataWebService._sWebWithTime[] siteTime = null;
SharePointSiteDataWebService._sListWithTime[] lstMData = null;
SharePointSiteDataWebService._sFPUrl[] urls = null;
string strSGroups;
string[] strSGrpUsrs;
string[] strSGrpGrps;
siteData.GetWeb(out siteMData, out siteTime, out lstMData, out urls,
out strSGroups, out strSGrpUsrs, out strSGrpGrps);
Anybody got any ideas? I have tried on and off for months to figure out
this problem.
Do you know someone who can help? Share a link to this thread on twitter, or facebook.