Home > Sharepoint > Create a new Site in Sharepoint

Create a new Site in Sharepoint

Adding new sites to our Portal is our next step. We do this using the add() method on AllWebs.
Note that there are a couple of values that we have to consider.
First three values are strings, staring with url, title and then description. next, we got the site language.
Then theres site template. Here you can use a few different templates depending on what kind of site you want.
In WSS 3.0 you can choose from the following Site Templates:


PS > [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
PS > $SPSite = New-Object Microsoft.SharePoint.SPSite("http://wss"); $SPSite.GetWebTemplates(1033) | Select Name, Description; $SPSite.Dispose()

Name                   Description
----                   -----------
GLOBAL#0               This template is used for initializing a new...
STS#0                  A site for teams to quickly organize, author...
STS#1                  A blank site for you to customize based on y...
STS#2                  A site for colleagues to work together on a ...
MPS#0                  A site to plan, organize, and capture the re...
MPS#1                  A blank meeting site for you to customize ba...
MPS#2                  A site for meetings that track status or mak...
MPS#3                  A site to plan social occasions. It provides...
MPS#4                  A site to plan, organize, and capture the re...
CENTRALADMIN#0         A site for central administration. It provid...
WIKI#0                 A site for a community to brainstorm and sha...
BLOG#0                 A site for a person or team to post ideas, o...

Lets Create a Blog Site. The WebTemplate that we want to use to create a Blog site is BLOG#0. Here's a function that simplifies the creation.


function Create-SPSite([string]$url, [string]$SiteUrl,[string]$Name, [string]$Description, [string]$Template) {
  [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

  $SPSite = New-Object Microsoft.SharePoint.SPSite($url)

  $SPSite.AllWebs.Add($SiteUrl, $Name, $Description, [int]1033, $Template, $FALSE, $FALSE)

  $SPSite.Dispose()
}

Create-SPSite -url http://wss -SiteUrl TheBlog -Description "Blogging is Fun" -Template "BLOG#0"

Now, the Blog site is added to our Sharepoint Portal.

sharepoint-14

Rating 3.00 out of 5
[?]
Categories: Sharepoint Tags:
  1. Vizo
    February 23rd, 2010 at 20:23 | #1

    Thanks for this it saved me a ton of time!!
    One question is there any way to get the new site to add its link under sites in the quick launch bar?

  2. April 5th, 2010 at 19:42 | #2

    Cheers very much, I have found this info extremely good!

  1. No trackbacks yet.

Spam Protection by WP-SpamFree