Home > Powershell, SharePoint, Site Directory > Creating a Site Directory in SharePoint 2010

Creating a Site Directory in SharePoint 2010

You may have noticed in General Application Settings within Central Administration there are two links which relate to a Site Directory, however no option to create a site collection or subsite based on the Site Directory template via the GUI.

The template is present in 14\TEMPLATE\1033\XML\WEBTEMPSPS.XML with template name SPSSITES but marked as HIDDEN, hence why it doesn’t appear in the GUI and to be fair, this functionality has been included just for backwards compatibility for upgraded environments.

A few posts around the Internet recommend hacking the XML and changing the Hidden attribute to FALSE.   This is far from ideal and I believe all changes to WEBTEMP*.XML files should be done through the object model especially in a multi-server farm.  Furthermore it’s not required either thanks to PowerShell.

If you need to create a site collection based on the Site Directory template, launch the SharePoint 2010 Management Shell and enter

New-SPSite <URL> -TEMPLATE “SPSSITES#0”

of course replacing the <URL> parameter with the location where you wish the site to be hosted.  You’ll be prompted for an OwnerAlias, enter the account of the primary site collection owner.

The site can also be created as a web underneath an existing site collection, however the Site Collection feature “SharePoint Server Publishing Infrastructure” must be activated.  To create as a web use this command.

New-SPWeb <URL> -TEMPLATE “SPSSITES#0”

That’s it, but if you have already hacked your WEBTEMPSPS.XML and the Site Directory template is not available, then it’s most likely because its visibility depends on the hidden “Portal Layouts Feature” which has the GUID 5F3B0127-2F1D-4cfd-8DD2-85AD1FB00BFC.  This can either activated through the excellent SharePoint Manager or via this PowerShell command.

Enable-SPFeature “PortalLayouts” -Url <Site Collection URL>

If you’re looking to offer better functionality from a Site Directory and you are able to install CodePlex solutions within your organisation, then check out  Site Directory for SharePoint 2010.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: