1: internal void CreateSite(string serverUrl, string serverRelativeUrl, string title, string description, uint LCID, string templateName)
2: {
3: SPSecurity.RunWithElevatedPrivileges(delegate()
4: {
5: using (SPSite siteCollectionOuter = new SPSite(serverUrl + serverRelativeUrl))
6: {
7: SPWebApplication webApp = siteCollectionOuter.WebApplication;
8: SPSiteCollection siteCollection = webApp.Sites;
9: SPSite site = siteCollection.Add(serverRelativeUrl, title, description, LCID, templateName, "DOMAIN\\\\Administrator", "Administrator", "Administrator@domain.it");
10:
11: //Add SecondaryContact to the SiteCollection
12: SPWeb web = site.OpenWeb();
13: web.AllUsers.Add("DOMAIN\\Admin", "Admin@domain.com", "Admin", null);
14: SPUser spUser = web.AllUsers["DOMAIN\\AmAdmin"];
15: site.SecondaryContact = spUser;
16: }
17: });
18: }