Office 365 / SharePoint 2013/2016 – Moving sites around

Have you ever tried to migrate a site from an on-premises SharePoint environment to Office 365? Or have you tried keeping development, test and production sites in sync?

Within an on-premises environment you would have been likely to hit issues with custom solution? Or you might have hit issues with recreating sites exactly the same way? Keeping internal field names and GUIDs the same can be a tricky job. Additionally search configurations can be difficult to replicate.

When using farm solutions to provision/update your sites it can be difficult update a site, especially when users can create fields, content types and lists manually.

When all is created and recreated manually within SharePoint then it’s just impossible to keep sites exactly the same.

Since early 2016 I’ve been playing with PnP-PowerShell. With some simple cmdlets it is possible to export and import sites. It is however easier said than done and I’ve seen many people new to PnP complain that it isn’t mature enough while they hit some minor issues that could easily be worked around. Additionally, it  is hard to keep up with the development happening. So many cmdlets and options  to cmdlets have been added.

In recent weeks I’ve already described a solution that improves PnP-PowerShell. I’ve developed the ideas of this solution during some of my projects at Triad. If you are less interested in doing these kind of site migrations yourself then I’m happy to get you in touch with the right people at Triad. Just leave a comment below.

By creating a config.xml it is possible to control a set of scripts that will export, import or copy multiple sites.

I’ve called it Tenant Migration and uploaded to the PnP github project. Once the PnP team has reviewed and accepted the scripts it should become available within the main branches until then it’s available within my personal dev branch.

The solution is now available on github within my master branch .

Big advantages of this solution:

  • It can handle multiple pages, unlike PnP out of the box
  • It can handle complex combinations of look-up fields and lookup lists
  • One click for
    • Reading all templates form a whole tenant
    • Updating a whole tenant wiht the set of templates
    • both reading templates and applying them
  • An option to disable/enable features
  • Fixing template issues in between getting the templates and applying them without any user intervention such as:
    • Updating security setting (usernames in different domains)
    • Fixing templates with mixes of team sites and publishing sites
  • Switching between latest and older versions of PnP PowerShell
  • Migrating simple data in lists ( e.g. lookup lists)
  • Handle external lists
  • Migrate from On-Premises to Office 365
  • … you name what you would like to add to this list

Getting Started

Well the best way to get started is to read the documentation.

https://github.com/PnP-PowerShell/tree/master/Samples/Tenant.Migration/Documentation

 

 

 

 

Once you’ve created a config.xml, CollectSolution.ps1 will export the sites that you have configured. ApplySolution will then apply all the templates and workarounds needed to create your copy of the site.

Advertisements

6 thoughts on “Office 365 / SharePoint 2013/2016 – Moving sites around

  1. Hi Pieter
    Many Thanks for this wonderful PnP Scripts.
    Could you please let me know if it also possible to migrate the contents all the list/Doc Lib within the Sites to with these scripts? If so, how could we indicate that in the config.xml file to migrate the contents from Source to the Target.
    Kind Regards
    Jack

    Like

    1. Hi Jack,

      In short, PnP templates don’t look at content.

      Depending on the amount of data that you need to migrate you could look at writing PowerShell scripts to copy files or use 3rd party tools to migrate the documents across. If you need any help with this feel free to get in touch.

      Like

Please leave a comment or feedback

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.