Change the root site collection of your tenant to modern SharePoint

Back in February this year I posted an article explaining how you can transform and modify a classic root site collection on SharePoint Online to look like a modern communication site.

This is by far the most viewed article on my blog this year with more that 10k visits, meaning that there are a lot of SharePoint admins trying hard to get a consistent modern experience on their intranets.

With the latest version of the SharePoint Online Management Shell a new command was introduced to swap SharePoint sites and it can be used to define a modern site collection as the root site of your tenat.

How does it work

In order to accomplish the steps below you need to get SharePoint Online Management Shell version 16.0.8812.1200 or later.

  1. Open the PowerShell console and type the authentication command. Please note that you need to use the Admin url.
    Connect-SPOService -Url https://contoso-admin.sharepoint.com
  2. Provide the authentication credentials
  3. Type the command below passing the parameters
    Invoke-SPOSiteSwap -SourceUrl https://contoso.sharepoint.com/sites/newIntranet -TargetUrl https://contoso.sharepoint.com -ArchiveUrl https://contoso.sharepoint.com/sites/oldIntranet

    SourceUrl – URL of the source site. The site at this location must exist before performing the swap.

    TargetUrl – URL of the target site that the source site will be swapped to. The site at this location must exist before performing the swap.

    ArchiveUrl – URL that the target site will be archived to. There should be no existing site, including a deleted site in the Recycle Bin, at this location before performing the swap.

Conclusion

With a simple PowerShell command, you will be able to finally provide a true modern experience to your users on SharePoint Online.

This can be used on other scenarios to rename site collections, you no longer need to keep old department names on the site collections. Keep your intranet organized and with URLs that mean something to the users.

Business vector created by freepik – www.freepik.com


24 Responses to “Change the root site collection of your tenant to modern SharePoint”

  1. Ricardo Carneiro

    August 23, 2019

    I have a doubt, my current Home SharePoint site is:
    https://xxxxxx.sharepoint.com/SitePages/DevHome.aspx

    I’d like to open a Modern site page when I type https://xxxxx.sharepoint.com.

    Is it possible using this command? I tried and got the following error:
    The archive URL must be within either /sites/ or /teams/ managed path.

    Could you advise?

    Thanks.

    Reply
    • João Ferreira

      August 23, 2019

      Hi Ricardo,

      Yes its possible, first you need to create the modern site, once you get it execute the command.

      You need to define a new URL for your old root site something like https://xxxxx.sharepoint.com/sites/oldhome if you define the url correctly you should not get the error.

      Let me know how it went, and if the issue persists let me know what are the 3 parameters you are using.

      Have a nice day

      Reply
      • Ricardo Carneiro

        August 24, 2019

        Now it is working.

        What I did now was to run the command line with any name on the ArchiveUrl.

        Initially, I thought the ArchiveUrl (site) should exist, probably it was my mistake.

        Everything is working now, I have a Modern site when type my https://xxxx.sharepoint.com

        Thank you very much.

        Reply
        • Ricardo Carneiro

          August 24, 2019

          Not sure, but if I try to use a HUB site as my TargetUrl, it will not work.

          Is that right?

          Best.

          Reply
          • João Ferreira

            August 24, 2019

            It’s right the HUB cannot be used as the Target URL

        • João Ferreira

          August 24, 2019

          Hi Ricardo,

          Thanks for the feedback I’m happy it is now working for you.

          Reply
          • Ricardo Carneiro

            August 25, 2019

            You are a SharePoint reference to me, love the content.

            Moro na Irlanda, mas quando for a Portugal, eu pago a Super Bock..rsss.

            Thank you very much.

          • João Ferreira

            August 25, 2019

            Obrigado Ricardo, fico à espera dessa Super Bock fresquinha 🙂

  2. Charbel

    August 26, 2019

    The ability to convert an existing classic root site collection to a modern one was highlighted in a uservoice:
    https://www.microsoft.com/en-us/microsoft-365/roadmap?filters=&searchterms=46338

    Would you happen to know what is different between a site swap and the new feature soon to be delivered?

    Reply
    • João Ferreira

      August 26, 2019

      Hi Charbel,

      This is a very good question and there is a big difference between the existent command and the one still being worked on.
      The Swap cmdlet explained in this article requires you to manually create a communication site and discard the old root site collection content, if you want to keep some of the content you will always need to manually copy the content to your new site collection.

      The enable Enable-SPOCommSite transforms a classic site into a modern site keeping the existent content.

      I’ve monitoring the evolution of this user voice thread during the year and it was real close to be delivered but due to some issues it got delayed.
      Below you will find some links that might be useful in a few weeks when this gets available.

      User Voice

      Status update on the delay

      Annoucement

      cmdlet documentation

      Have a nice day 🙂

      Reply
  3. Ingo

    September 11, 2019

    Great and Easy…..you made my day. Thanks a lot. Changed an old default site (2015) to the new modern Communikation site. Next Beer on me 🙂

    Reply
    • João Ferreira

      September 11, 2019

      Hi Ingo,

      Thanks for letting me know and thanks for the beer 🙂 I am glad you were able to bring your SharePoint to the modern era.

      Have a nice day

      Reply
  4. Andre Paganuchi

    September 30, 2019

    It works like a charm! Perfect!
    Thank you so much for this!!

    Reply
    • João Ferreira

      October 1, 2019

      Thanks for your feedback Andre, I really apreciate it. Have a nice day

      Reply
  5. Lo2Yolatino

    October 14, 2019

    @Joao Ferreira
    I really appreciate your help.

    – Can we revert to the original page if the siteswap outcome is a disaster?

    – Invoke-SPOSiteSwap – is this the only way to make HomeSite as the official homepage?

    Reply
    • João Ferreira

      October 14, 2019

      Hello,

      Yes you can revert to the original, you have to execute the site swap to make the original site collection as a root again.

      There will be another method that will convert a classic site to modern but as far as I know is not yet available.

      Have a nice day 🙂

      Reply
      • Lo2Yolatino

        October 15, 2019

        Thank you so much for your help.
        Much Appreciate it @Joao
        Great Day as well

        Reply
  6. Rui Jácome

    November 22, 2019

    Olá Ricardo,

    Estou a tentar fazer o swap, mas quando insiro o segundo comando com os meus URLs recebo o seguinte output:

    Invoke-SPOSiteSwap : The term ‘Invoke-SPOSiteSwap’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
    correct and try again.
    At line:1 char:1
    + Invoke-SPOSiteSwap -SourceUrl https://mydomain.sharepoint.com/sites/
    + ~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Invoke-SPOSiteSwap:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    O URL “source” existe correctamente.

    Alguma ideia do que pode estar a acontecer?

    Reply
  7. Matt

    December 4, 2019

    Thank you – this was helpful.

    Reply
  8. Katherine Prouty

    February 11, 2020

    I have a question. I have a classic site with publishing enabled. It has many subsites. In order to do this smoothly, I should recreate all the subsites first, stick them in the navigation of the classic home page, and THEN create a new modern site for the home page, swap the sites, and then hubify everything.

    I am assuming when I swap sites, the root site and ALL of the subsites will be archived?

    Reply
    • João Ferreira

      February 12, 2020

      Hi Katherine,

      I totally understand your plan and it makes sense but unfortunately this commandlet will not do the trick.
      This will only swap the site collection with all the content on it, your subsite will continue to live under your classic site.
      If you just want to get a modern page as a landing page of your intranet you can follow this article

      On the Microsoft side of the house and official way to do this is still under development, you can vote here to help it to become available faster.

      Hope this helps you, let me know how things went.
      Have a nice day

      Reply
  9. Katherine Prouty

    February 12, 2020

    I don’t think I was clear.

    I have aclassic publishing site. Underneath that site, I have other classic subsites (without publishing turned on, not that it matters.)

    1. I take all of the subsites and rebuild them as NEW modern sites. I make them from scratch, move the content over.

    2. As I rebuild them, I change the nav in the classic publishing site to point to the new modern site so things can be done in stages.

    3. When all of the subsites are basically done moving to the new modern sites, I create another site to use as the landing page.

    4. I make the swap and then hubify everything. ALL the content in the subsites has already been moved over to the modern so everything can be archived.

    Reply
    • João Ferreira

      February 13, 2020

      Hi Katherine,

      I misunderstood your original question. You are following the right approach and you can do it using the site swap.
      The only thing you need to take care after doing the swap is archiving the old site collection as this commandlet doesn’t do it.
      Since you are on this journey to modernize your SharePoint let me suggest you the latest Intrazone episode from Microsoft where the hub and subsites topic is addressed, you may find some ideas that will help you along the way.

      https://intrazone.libsyn.com/designing-your-intranet

      Have a nice day 🙂

      Reply

Leave a Reply to João Ferreira


I've been working with Microsoft Technologies over the last ten years, mainly focused on creating collaboration and productivity solutions that drive the adoption of Microsoft Modern Workplace.

%d bloggers like this: