Monday, 15 June 2009

Renaming SharePoint Site Collections (the Secret of Managed Paths)

Everyone knows, or at least should know, that SharPoint sites (formally referred to as Webs) can be easily renamed with either stsadm -o renameweb or through the GUI.

But what about renaming site collections?

Well, the short answer to that question is no. Site collections cannot be renamed, at least not those on managed paths.


Hosted site collections using host headers can be renamed using the stsadm -o renamesite command but it is limited to hosted sites only.

e.g. ->

Yes, another massive limitation of the current SharePoint version. But the real culprit - and what makes this all the more confounding - is managed paths. If you've never had any real experience with these little beasties then I envy you. But get ready to put your hard hat on because we're going in.

You can create a managed path for a site collection using one of two options - "Explicit exclusion" or "Wildcard inclusion" - but not both! The limitations of this will become obvious soon.

Let's say you want the following structure for your site collections:

- where both groups and team 1 are site collections.

This cannot be achieved conventionally. The reason is because to create a site collection at the managed path of /groups it must be set to "Explicit exclusion" - meaning you cannot create site collections below this path.

And if you create the /groups path to use "Wildcard inclusion" then you can only create sites below this path. Make sense?

i.e. domain1/groups/my_sitecollection

This means that site collections can have no distinct hierarchy. Not that this matters given that they are treated as separate entities and current version web parts are unable to query across site collections anwyay!

So is there a workaround to both these limitations? I'm glad you asked. ;)

The following refers to explicitly renaming a single site collection which uses "Explicit exclusion" only. Depending on your needs you can use "Wildcard inclusion" for ensuing site collections.

To rename a site collection you need to:

  1. Backup your exsiting site collection using stsadm -o backup.
  2. Create a managed path of newpath "Explicit eclusion" using the new name you want.
  3. Restore the site collection to the new URL using stsadm -o restore.

To create a virtual URL hierarchy you can:

  1. Create a managed path of newpath/newsite "Explicit exclusion".
  2. Create a new site collection using this path.

Yes, it's true! MOSS will allow you to create a managed path in this form, despite the explicit exclusion on the original /newpath path.

Great isn't it? Now, whether this is intended or flawed behaviour, or a good idea or not is another matter entirely. ;)

Either way - good luck! And may version 14 resolve these and many other issues we're plagued with.

1 comment:

Adrian Williams said...

Handy to know - be aware when doing this that SharePoint does traverse the managed paths and there is a supported maximum (soft limit) to keep the number of managed paths below 20. See for details.