Using Invoke-SPOSiteSwap to Swap in a New Root Site in Office 365 – Follow Up

Last week, I wrote a post about using Invoke-SPOSiteSwap to swap a new modern site into the root site of our Sympraxis tenant. While it worked just great, there were some follow on issues I wanted to document in case you might run into them, too. Nothing horrible, but a bit of required cleanup.

The old classic site we had in the root had subsites. I had been syncing the libraries in some of those subsites with OneDrive, so there were nice folders showing up in Windows Explorer where I would do my work with those files. After the swap, I started getting errors from OneDrive which were a little confusing.

While the error was saying :

We can't reach this library because of a service Issue. 
Restart OneDrive to try again. 

…in actual fact, those libraries simply weren’t there to sync anymore. No matter how many times I would restart OneDrive (and I did once before I realized the problem!), those libraries were never going to start syncing again. Instead, I needed to go into the OneDrive settings and Stop sync for the libraries which weren’t there anymore.

Then I just navigated to their new location and started syncing again. This is certainly an argument for not using subsites anymore.

You might say “Well, of course, Marc! This is all your fault!” Well, sure it is. But the errors didn’t tell me the right cause, so it might be useful for others to know what it means.

In the SharePoint Dev Weekly – Episode 49 call this week, Vesa Juvonen (@vesajuvonen) and Waldek Mastykarz (@waldekm) talked about the fact that links will NOT be fixed up in the site swap (43:11). I had been under the impression that they would be. This didn’t bite me in particular, but it’s something to watch out for.

Vesa also mentioned (46:23) that the Invoke-SPOSiteSwap cmdlet is currently hard-wired to prevent you from using it to swap a site into any location other than the root site. In my usual “trust but verify” mode, I tested it, and what he says is indeed true.

You end up with an error like:

Invoke-SPOSiteSwap : The target URL must be the root site or the search center site
 At line:1 char:1
 Invoke-SPOSiteSwap -SourceUrl …
 ~~~~~~~~~~~~~~~~~                           int.PowerShell.SwapSite CategoryInfo          : NotSpecified: (:) [Invoke-SPOSiteSwap], ServerException
 FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.SwapSite

All in all, still a successful exercise. Happy swapping!

from Marc D Anderson’s Blog