1

Could someone suggest me a simple powershell script I can use to copy a content type and a list (excluding the content) from one site collection to another. I am thinking it can easily be done using pnp powershell but I still a novice. Will appreciate your help.

Thanks.

6
Connect-PnPOnline https://yoursite.com/sites/yourFIRSTsite
Get-PnPProvisioningTemplate -Out "MyTemplate.xml" -Handlers Lists,ContentTypes
Disconnect-PnPOnline
Connect-PnPOnline https://yoursite.com/sites/yourSECONDsite
Apply-PnPProvisioningTemplate -Path "MyTemplate.xml"
Disconnect-PnPOnline

Depending on how many lists/content types are on the site you might want to open the MyTemplate.xml file before applying it to the second site and manually delete any entries you don't want to copy over.

Documentation

  • Can I do same with "include content" with PnP?.. I use C# example - it copies lists but they are empty.. – Gennady G Feb 28 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.