Thursday, November 6, 2014

How to create programatically new document library in SharePoint using Client object Model?

string siteUserName="nam",_siteurl="http://sharepoint.com",_sitepassword ="pass@word1";

ClientContext clientContext = new ClientContext(_siteurl);
 clientContext.AuthenticationMode =ClientAuthenticationMode.Default;
 clientContext.Credentials = new System.Net.NetworkCredential(_siteUserName, _sitepassword, _domainName);
  Web oweb = clientContext.Web;

ListCreationInformation lci = ListCreationInformation();
                           lci.Description = "Test";
                           lci.Title = "TestName";
                           lci.TemplateType = 101;
                           SharePointclientObj.List newLib = clientContext.Web.Lists.Add(lci);
                           clientContext.Load(newLib);

                           clientContext.ExecuteQuery();

No comments:

Post a Comment