Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

SiteData Web Service - sporadic 401 error when calling GetWeb

  Asked By: Adrianna    Date: Jan 05    Category: Sharepoint    Views: 2541

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
siteData.Url = "http://" + _spServer + _listPath +

// 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.



No Answers Found. Be the First, To Post Answer.