Transforming subsite to a Site Collection Transforming subsite to a Site Collection SharePoint 2013 SharePoint 2013 Page 1 Transforming subsite to a Site Collection Recently I’ve come across a request where a business unit wanted to decouple a sub site from its Site Collection and have it as a Site Collection itself; see fig below Site Collection – Alpha Sub Site A1 Sub Site Alpha1 Sub Site Alpha1 Decoupled fro Alpha to be set as a new Site Collectio Beta Su Site …n Site Collection – Beta …to e reated Here, I’m trying to prepare a detailed step by step implementation document which might help some (or many; may be) in future who get such a request. Let’s start by calling the first site collection (where the sub site exists) as Alpha; the subsite under it as Alpha1 and the new Site Collection (to which it is to be transformed to) as Beta. 1. Know the size of Alpha1 – Before we even begin thinking of starting the movement; let’s find out the size of Alpha1. This is important to know before hand in situations where Space allocation to SharePoint Site Collection is limited OR; as in our case over analyzed for approvals etc. Depending on the size of this subsite, we’ll have to create Beta allotting it sufficient storage quota. This can be done in a lot of ways, the one I used was rather a work around (some might say it – back door entry). However it gives you a fair idea of the required quota. Here’s what you can do: i. ii. Open Alpha in Internet Explorer. Navigate to Site Content Open any document library. On the top ribbon, click on Library > Open with Explorer iii. iv. This will open an explorer window. Navigate a level up; from library level to the Site level. This will show all folders available under the site. Select the folder that corresponds to Alpha1. Right-click and select Properties. This will display the size. v. SharePoint 2013 Page 2 Transforming subsite to a Site Collection 2. Export Alpha1 – We have the size Alpha1 would require. We’ll use this info later when we create Beta. Now we’ll export Alpha1. We’ll use PowerShell command to do this – Export-SPWeb http://<Server>/sites/<Alpha>/<Alpha1> -Path D:\Backup\Alpha1.bak -IncludeUserSecurity IncludeVersions all Running this might take some time if your sub site is big (my command took around 2 – 2.5 hrs for a 10 GB site). 3. Create Beta – Now that we have our source data exported; we should create the location where we’ll put it. Let’s create a Site Collection. To create one, you can either use Central Administration (CA) or use a PowerShell command. I first created it from Central Administration. However while putting the exported data it threw an error – I got this error because Alpha1 was created using ‘Blank Site Template’ and I could not find such an option while creating Site Collection using CA. So to tackle this, PowerShell again came to my rescue – New-SPSite http://<Server>/sites/Beta -OwnerAlias "DOMAIN\<user name>" -Template "STS#1" Note: STS#1 is template code for Blank site. This is how the command would end up on a successful run SharePoint 2013 Page 3 Transforming subsite to a Site Collection 4. Match and Activate SharePoint Features – So, our site collection; Beta is ready. Now we should bring it to the level (settings/features wise) of Alpha1. Go ahead and activate all the required features; comparing from Alpha1. This will help in avoiding probable issues related to master pages, site pages, workflows etc. 5. Extend the storage quota of Beta Our new site collection (Beta) is created. Next step would be to increase its storage quota referring to size of Alpha1 which we noted in Step 1. We should allocate the quota considering the growth factor of Beta. For e.g. – if the subsite was of 10 gigs and the growth rate is 2 gigs per quarter it is always safe to allocate 20 gigs to Beta. Again it’s a judgement call. You can mold it as per your wish and will with some applied rational. To do this – i. ii. iii. Open CA > Application Management Under ‘Site Collection’ heading click on Configure quotas and locks. From Site Quota Information, select the appropriate option. 6. Import Alpha1 onto Beta – Beta is now ready for import. Let’s put the exported site onto Beta. To do this I’ll again take help of PowerShell command Import-SPWeb http://<Server>/sites/<Beta>/ -Path D:\Backup\Alpha1.bak -IncludeUserSecurity SharePoint 2013 Page 4 Transforming subsite to a Site Collection Once the command completes, the command prompt will show An Import.log file will be generated when the import process starts. Upon completion, open this log file and look for errors (if any). There may also be some warnings but I would prefer ignoring them and work on the errors. If there are errors in the import process, they will be logged in this file. To view them, go to the end of this file. You will see status like – If errors are recorded, look for them in the file and fix them. Once fixed, delete Beta and repeat steps 3-6. If the process is clean, you’ll see this – Technically, the transformation is complete. Beta is ready. I will however recommend to have a thorough testing of all major functionalities on the site. A few of things to keep in mind are – i. ii. iii. User alerts set on Lists/libraries/documents etc. will not be copied over. You’ll have to reset them. Recycle Bin items are not copied over Workflows might not be copied over Reference: https://technet.microsoft.com/en-us/library/cc706866.aspx iv. On some pages you might see a Message saying – This can appear on pages which were customized using SPD or any other means. Clicking on “Revert to Template” I got rid of the message. v. If you had changed the look of your subsite, you might have to do the same on this new site as well. SharePoint 2013 Page 5 Transforming subsite to a Site Collection One major issue which I faced was with the Publishing feature. Somehow “Pages” library was not functioning properly. Every time we tried creating a new page, it threw an error (The all famous “Something went wrong” error). Similarly with “Page layouts and site templates” in site settings I got the same error. This could be occurring because in PublishingWeb’s properties, the DefaultPageLayout item is null and/or empty. To fix this we need to run the below PowerShell script – Add-PSSNapin Microsoft.SharePoint.PowerShell [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Publishing") $site = Get-SPSite http://<server> /NewSiteCollection/ $publishingSite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($site) $publishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($site.RootWeb) $pageLayout = $publishingWeb.GetAvailablePageLayouts() | ? { $_.Name -eq "BlankWebPartPage.aspx" } $publishingWeb.SetDefaultPageLayout($pagelayout, $true) $publishingWeb.Update() Taking care of these hiccups; you should be ready to Go-Live with the new Site collection. Not to forget, running all the above commands should be done by an account which is a member of the Administrators group on the local server. SharePoint 2013 Page 6