You can access any site collection programmatically as below code
You have to use Authentication.asmx web service for authenticate any user.
Then you can access any lists of this site.
// /_vti_bin/Authenticate.asmx web service's Object
Authentication.Authentication objAuthentication = new Authentication.Authentication();
objAuthentication.CookieContainer = new System.Net.CookieContainer();
LoginResult loginResule = objAuthentication.Login("username", "password");
if (loginResule.ErrorCode == LoginErrorCode.NoError)
{
CookieCollection objCookieCollection = objAuthentication.CookieContainer.GetCookies(new Uri(objAuthentication.Url));
Cookie authCookie = objCookieCollection[loginResule.CookieName];
// /_vti_bin/Lists.asmx web service's Object
Lists.Lists objLists = new Lists.Lists();
objLists.CookieContainer = new CookieContainer();
objLists.CookieContainer.Add(authCookie);
System.Xml.XmlNode objListXMLNode = objLists.GetList("Shared Documents");
}
Happy Coding !!!
what is Authentication.Authentication?
ReplyDeleteusing..............?