Saturday, September 19, 2009

Programmatically Create Site Collection

Title:Programmatically Create Site Collection
Code:

void CreateSiteCollection(string requestUrl, string siteUrl, string title, string description, uint lcid, string webTemplate, string ownerLogin, string ownerName, string ownerEmail)
{
SPSite site = new SPSite(requestUrl);
SPWeb web = null;
try
{
SPWebApplication webapp = site.WebApplication;
web = site.OpenWeb();
SPSiteCollection spSites = webapp.Sites;
webapp.Sites.Add(siteUrl, title, description, lcid, webTemplate, ownerLogin, ownerName, ownerEmail);
}
finally
{

}
}

No comments: