Second Life of a Hungarian SharePoint Geek

November 6, 2013

How to change the structure of sharePoint site in a site collection

Filed under: PowerShell, SP 2010, Tips & Tricks — Tags: , , — Peter Holpar @ 23:08

SharePoint sites can be created using a wrong URL name, or in an even worse case, under a wrong parent site. In both cases the site is located at a URL that is somehow not ideal for the users. If there is no content in the new site yet, it is probably the easiest to delete and re-create the site using the right name / at the right place. However, if the users created a lot of content in the site, we should find another solutions to handle the mistake. It is good to know that there are alternatives for such issues.

Solution 1: If the site is created under the correct parent site but with a wrong name, it is the easiest to fix the name via the SharePoint UI. As described in this post, you can change the name under Site Actions / Site Settings / Title, description, and icon. This method does not help to move sites between parent sites.

image

Solution 2: One of my colleagues, Verena has found another solution via PowerShell:

Get-SPWeb http://yoursite/siteX | Set-SPWeb -RelativeUrl subsite1/siteY

Using this method, we can not only rename the site, but we can move it under an existing subsite as well. It is important to point out, that based on our experience, this method does not work in the other direction, that means, we cannot move a site up in the hierarchy, like from under a subsite to the root site. Thanks Verena for this solution, and happy birthday! Birthday cake

Solution 3: Using the ServerRelativeUrl property of the SPWeb object we can alter the structure of the sites as well. This method seems to be pretty flexible, makes it possible to change the site relationships in both directions.

$web = Get-SPWeb http://yoursite/subsite1/siteX
$web.ServerRelativeUrl = “/yoursite/siteY”
$web.Update()

It is an interesting question, how the methods 2 and 3 above handle the case, when the site permissions are configured to be inherited from the parent site. Do they keep the permissions inherited from the original parent site? Or the permissions of the new parent site will be inherited? Recently we had to move sites using these methods, but in our case the sites had always their own permission sets, so I cannot answer this question right now.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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

Blog at WordPress.com.

%d bloggers like this: