Welcome to EMC Consulting Blogs Sign in | Join | Help

Paul Galvin's Blog

Quick and Simple: Provision a Web Site Using SharePoint Object Model In C#

I tried searching for a little snippet code that would show how I can create a new SPWeb in a site collection.  I didn't find it as quickly or easily as I expected so I thought I'd slap together a little entry on the subject.

This code creates a new Wiki site:

    SPSite siteCollection;

    siteCollection = new SPSite("http://conchang-o9l8qi");

    SPWeb w = siteCollection.OpenWeb();

    w.Webs.Add("xyzzy", "xyzzy Title",
        "xyzzy description", 1033, SPWebTemplate.WebTemplateWIKI, false, false);

My initial searches failed because I was looking for phrases like "provision a web site using sharepoint object model" and the like. 

If you search for "Webs.Add()", you'll find a number of very useful blog entries, MSDN articles and SDK documentation that go into depth on this subject.  I definitely recommend this site.

</end>

 Subscribe to my blog.

Technorati Tags:
Published 11 March 2008 18:50 by Anonymous
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems