SharePoint4us

Explore the Experience in SharePoint 2013

Tuesday, June 24, 2014

2 comments
Create Site Using Client Object Model in .net Model

In C# ,

In Order to work with .net managed Code ,We need to refer Microsoft.SharePoint.Client.dll from ISAPI folder in 15 hive .

Once this is done,we can write a Windows or Console Application for creating a Sample Site Creation .




string  siteDescription="New Site created using .net Managed Client";
siteTitle="TestSite";
siteUrl="http://servername/" 
 
public void CreateSite(string siteDescription, string siteTitle, string siteUrl)
{
  rootWeb = rootWeb.Webs.Add(new WebCreationInformation
    {
      Description = siteDescription,
      Title = siteTitle,
      Url = siteUrl,
      UseSamePermissionsAsParentSite = false
    });
  clientContext.ExecuteQuery();
}