Friday, August 30, 2013

Create SharePoint website using SharePoint 2013 client object model

Here we will discuss how to create SharePoint website using SharePoint 2013 client object model. Also check:

- Get UserProfile using SharePoint 2013 object model

- New feature in SharePoint 2013 event receivers

- Audio and Video content type in SharePoint 2013

Below is the full code that will create a new SharePoint website:

ClientContext context = new ClientContext("http://SiteURL");

WebCreationInformation webCreationInfo = new WebCreationInformation();

webCreationInfo.Url = "MyTestWebSite";

webCreationInfo.Title = "My Test WebSite";

webCreationInfo.Description = "This is our new test web site created from client object model in SharePoint 2013";

Web newWeb = context.Web.Webs.Add(webCreationInfo);

context.Load(newWeb, w => w.Title);


String newWebTitle = newWeb.Title; 

Twitter Delicious Facebook Digg Favorites More