This is the 10th day of my participation in the Novembermore Challenge

Use SharePoint PNP to migrate the site

1. Install the PnP

There are three ways to install a CMDlet. Just pick one

1. PowerShell library

If your primary operating system is Windows 10, you can run the following command to install PowerShell cmdlet:

SharePoint version Install command
SharePoint Online Install-Module SharePointPnPPowerShellOnline

2. Install files

You can download the installation file from the distribution section of the PnP PowerShell repository. These documents will be updated monthly. Run the installation and restart any open PowerShell instances to use cmdlet.

3. Install the script

This is an alternative to installing on a computer that has at least PowerShell V3 installed. You can open the PowerShell and run $PSVersionTable. PSVersion. The value of Major should be greater than 3.

To install the CMdlet, run the following command, which will install PowerShell package management and then install the PowerShell module from the PowerShell library.

Invoke-Expression (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/pnp/PnP-PowerShell/master/Samples/Modules.Install/Insta ll-SharePointPnPPowerShell.ps1')Copy the code

Update 2.

Update-Module SharePointPnPPowerShell*
Copy the code

You can check the installed pNP-PowerShell version using the following command:

Get-Module SharePointPnPPowerShell* -ListAvailable | Select-Object Name,Version | Sort-Object Version -Descending
Copy the code

Introduction to 3.

To use the library, you first need to connect to your tenant:

Connect - PnPOnline - Url https://yoursite.sharepoint.com - Credentials (the Get - the Credential)Copy the code

Note: If you are using multiple authentication for tenants, please use generally this one please note to replace with your own site

Connect-PnPOnline -Url https://yoursite.sharepoint.com -UseWebLogin
Copy the code

To view all cmDlets, enter

Get-Command -Module *PnP*
Copy the code

4. The real

First we connect to a SharePoint library

Connect-PnPOnline -Url https://yoursite.sharepoint.com -UseWebLogin
Copy the code

Get the PnP configuration file so that we can copy this site to another SharePoint site

 Get-PnPProvisioningTemplate -Out myfile.pnp
Copy the code

After running this command in PowerShell for a while, package the myfile.pnp file

We can view a file of type PnP as a compressed package and we can see that when we change the suffix and unzip it

Is a site just created so empty but sparrow although small five viscera complete, basic functions are some

Upload the PnP configuration file of site A to site B

First connect to site B

Connect-PnPOnline -Url https://yoursite.sharepoint.com -UseWebLogin
Copy the code

Upload configuration (note the file path)

Apply-PnPProvisioningTemplate .\myfile.pnp -ClearNavigation
Copy the code

After waiting, you can see that we have successfully migrated the site