Friday, October 4, 2013

Migrating content from SharePoint 2010 on-premises to Office365–a non-working approach

Disclaimer: This post describes a failed attempt to streamline the migration of an on-premises 2010 site to a SharePoint On-line (2013) site without the help of 3rd party tools.

When you have some spare time it’s good to dog food what you preach. And we preach a lot to customers about options of migrating from SharePoint 2010 to SharePoint 2013. There are no silver bullet approaches to this as far as I know (and feel free to prove me wrong), so I thought I’d try what I call the Lazy Consultant approach to this.

This approach involves saving a site as a template with all the content included, then “fixing” the wsp file, and uploading it into SPO where you create a new site based on the uploaded template.
For the sake of the argument here are some other approaches which you should consider:
  • IT Pro Approach – Third party product from vendors like Metalogix, ShareGate or AvePoint
  • End-user approach – Open two explorer windows and drag/drop the files you want to migrate, which won’t work for wiki libraries or lists
  • Developer approach – Custom tool to extract content and provision sites, sort of like the poor mans 3rd party approach, except it can quickly be really really expensive
Pre-requisites for this solution is changing the default max size for template exports to accommodate the size of your content. The default limit is 10mb, and in my case I upped it to 100mb. The maximum you can set it to is 500mb, so if you have more content then this approach is not possible.

Changing the max size for a template might be outside the scope of a Power User, but if you have clout with IT, have them run the following in PowerShell to fix it.

# Increase export to 100mb
$docSize = 100000000
$webservice = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$webservice.MaxTemplateDocumentSize = $docSize
$webservice.Update()

Save site as a template

For my test case I have chosen what we at Puzzlepart have named “University” on our intranet. This site is a How-To site on all matters concerning the company including how to buy pc collateral, how to order lunch, how to write expense reports, and what are your pension benefits. Basically a content-only site with wiki pages and documents.

In order export the site and content you navigate to Site Settings in SharePoint and click “Save site as a template”.

image

Remember to check off “Include Content” before hitting OK to be sure you include the content. If you have a lot of content and want to do a dry-run first, then you can skip including the content the first time around.

image

Once the process has completed the template is saves as a solution package in the site collection of your site.

image

Click the name of the package to save it on your local computer.

2013’ify the package

The downloaded solution package is now a 2010 package and not compatible as a 2013 site template in SharePoint Online. The trick is that a WSP file is actually a CAB file, and you can unpack it with several tools like 7-zip or WinRar. The hard part is re-creating the CAB/WSP file, but we’ll get back to that later.

In my case I used 7-zip and extracted the files to a folder on my Desktop.

image

The resulting folder contents lists like below:

image

The first step involved is finding the file named Onet.xml which among other things define the sites features and list types used in the template, and open it in your favorite text editor.

The first row of the file will look something like this, with an emphasis on the UIVersion tag.

<Project Title="uni2010" Revision="0" UIVersion="4" SiteLogoUrl="/Style Library/pzlintra/sitelogo.png" SiteLogoDescription="" xmlns="http://schemas.microsoft.com/sharepoint/">


In order to make the package compatible with SharePoint 2013 we change the number 4 to 15. (4=SP2010, 15=SP2013)

<Project Title="uni2010" Revision="0" UIVersion="15" SiteLogoUrl="/Style Library/pzlintra/sitelogo.png" SiteLogoDescription="" xmlns="http://schemas.microsoft.com/sharepoint/">

The next step is packing up the previously extracted to a new WSP file. This time 7-zip and WinRar comes up short. After some internet searching I ended up installing IZArc which can create CAB files with an intuitive UI, and it also works with a ton of other archive formats as well.

Fire up IZArc and click the “New” button and name your file. In my case I named it uni2013.cab.

image

Next browse to the folder where you extracted the 2010 WSP package and select all folders and the manifest.xml file.

image

Once the file is created rename it to a WSP extension. uni2013.cab –> uni2013.wsp.

Uploading the template to SharePoint Online

Navigate to the site collection in SharePoint Online you want to provision the site, and once again navigate to the Solution Gallery from Site Settings.

image

Upload your solution and make sure it’s activated.

image

Create/Import the site

Now is the time to create a new site based on the 2010 template with all the content. Navigate to Site Contents of your SPO site collection and create a new subsite. The newly installed template should appear below the Custom tab for the template selection.

image

Once you click “Create” you will most likely be presented with an error like below, listing all features not enabled or present in SPO which was enabled on the old 2010 site.

image

In my case these features were not important for the solution and the quick fix is going back to Onet.xml, finding the referred GUID’s and remove the entries/lines from the file. Once saved you have to go back and re-create the CAB/WSP file, deactivate the previously uploaded solution in SPO, and upload the new one. This is the reason why you might want to exclude the content the first time you do this to save time.

image

Next time around everything should go smooth, and your site should be up and running in 2013 mode.

Show stopper!!

This is what my site looked like after it was provisioned, and to tell you the truth, not very pretty. The reason being it still links to the old v4.master, and it does not include the modules for 2013 layout.

image

What would work is introducing four extra steps, but then it’s suddenly not so streamlined.
  1. Export WSP from 2010
  2. Import WSP into a 2010 style site collection in an on-premises 2013 installation
  3. Create a 2010 site based on the template
  4. Upgrade the site to 2013 mode
  5. Export the site as template
  6. Edit onet.xml and remove reference to the 2010 web template (and any feature edits)
  7. Upload to SharePoint Online and provision a new site

3 comments:

  1. Have you ever come across migrating SharePoint 2007 custom site template to SharePoint 2010 site?

    ReplyDelete
    Replies
    1. Is it created as saving a site or created in Visual Studio? Either way, try to import the wsp into Visual Studio and change it..then rebuild.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete