sreenu kolusu

sreenu kolusu

  • NA
  • 38
  • 181.4k

Sharepoint 2010 Client object Model Using in Windows application

Aug 9 2012 2:42 PM
 Client object Model Using To Create Site

   ClientContext clientContext = new ClientContext("http://demoshare:6969/YourSite/");
            System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("Administrator", "@Nivista123", "sp.com");
            clientContext.Credentials = credentials;
                WebCreationInformation wci = new WebCreationInformation();
                wci.Url = "YourSite1"; // Relative URL
                wci.Title = "YourSite1";
                wci.Description = "Your nice description.";
                wci.UseSamePermissionsAsParentSite = true;
                wci.WebTemplate = "STS#0";
                wci.Language = 1033; //LCID

               Web w = clientContext.Site.RootWeb.Webs.Add(wci);
                              clientContext.ExecuteQuery();
                MessageBox.Show("site created");



 Client object Model Using To Create SubSite

   ClientContext clientContext = new ClientContext("http://demoshare:6969/YourSite/");
            System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("Administrator", "@Nivista123", "sp.com");
            clientContext.Credentials = credentials;
                WebCreationInformation wci = new WebCreationInformation();
                wci.Url = "YourSite1"; // Relative URL
                wci.Title = "YourSite1";
                wci.Description = "Your nice description.";
                wci.UseSamePermissionsAsParentSite = true;
                wci.WebTemplate = "STS#0";
                wci.Language = 1033; //LCID

               // Web w = clientContext.Site.RootWeb.Webs.Add(wci);
                Web w = clientContext.Web.Webs.Add(wci);
                clientContext.ExecuteQuery();
                MessageBox.Show("subsite created");

Answers (1)