Wednesday, 5 September 2012

Create a New Site

1. Create a New Site

SPSite site = new SPSite("http://Mohan");//http://sitename
        //makes connection and opens the site to allow modification
        /* SPWeb :- Gets the collection of Features that are currently
         * activated in the Web site.
         *
        **/
        SPWeb web = site.OpenWeb();
        //Security setting that allows you to add to / modify the site
        web.AllowUnsafeUpdates = true;
        //creates context in the site to create a new subsite
        //SPWebCollection :-(The SPWebCollection class represents a collection of SPWeb objects.)
        SPWebCollection subsite = web.Webs;
        try
        {
            SPWeb newSubWeb = subsite.Add(@"Testing1","testing only","Testing only desc",1033,"STS#0",false,false);
          
            Response.Write("New site created.");
        }
        catch (Exception ex)
        {
            Response.Write("Is not created.." + ex.Message);
        }
           
       
        //STS#0 Team site
        //STS#1 Blank site
        //STS#2 Document workspace
        //MPS#0 Basic meeting workspace
        //MPS#1 Blank meeting workspace
        //MPS#2 Decision meeting workspace
        //MPS#3 Social meeting workspace
        //MPS#4 Multipage meeting workspace
        //WIKI#0 Wiki
        //BLOG#0 Blog
        //BDR#0       Document center—A central document management
        //            location for an enterprise
        //OFFILE#0    Records center—A central location in which records
        //OFFILE#1    managers can define routes for incoming files
        //CMSPUBLISHING#0 Publishing site
        //BLANKINTERNET#0 Publishing site—A site for publishing web pages on a
        //        schedule with workflow features enabled
        //BLANKINTERNET#1 Press releases site
        //BLANKINTERNET#2 Publishing site with workflow—A publishing site for web
        //        pages using approval workflows
        //SPSNHOME#0 A site for publishing news and articles
        //SPSREPORTCENTER#0 Report center—A site for creating, managing, and delivering
        //        web pages, dashboards, and Key Performance
        //        Indicators (KPIs)
        //SPSPORTAL#0 A starter hierarchy for an intranet divisional portal
        //PROFILES#0  A profile site that includes page layouts with zones
        //BLANKINTERNETCONTAINER#0 Publishing portal—a site collection preconfigured for
        //        revision-controlled, secure content creation and publication
        //SPSMYSITEHOST#0 My Site host—keep in mind that only one of these can be
        //        provisioned per Shared Services Provider
        //SRCHCENTERLITE#0 Search center—A site designed to deliver the search query
        //        and results experience
        //SRCHCENTERLITE#1 Search center—A superset of the previous; does not
        //        appear in navigation bars

No comments:

Post a Comment