pnp / pnp/powershell

[BUG] Copy-PnPList doesn't retain Document Set content type inheritance (across sites)

Open
#4,381 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
904
Forks
407
Avg merge
9h 16m
Merged PRs (30d)
10

Description

Expected behavior

When I copy a document library configured with document sets, I expect the content type configuration to be copied as well.

Actual behavior

When copying a list, the content type is copied, but it inherits from "Item" instead of "Document Set".

Note that this works if correctly if you copy to the same site. It doesn't work when correctly when you copy to a different site (on the same tenant).

Steps to reproduce behavior
  • Create a content type with parent content type "Document Set" in the TENANT (!) content type gallery (e.g. "Project") - you may need to activate the Document Set feature on the /sites/contenttypehub site collection first

  • Add a field "Owner" type Person or Group with default settings

  • Create a new (non-Microsoft 365-connected) Team Site "docsettest"

  • Enable the management of Document Sets on site level

  • Create a library Source

  • Enable the management of Content Types

  • Add content type from existing content types - select newly created "Project" content type

  • Go to list settings and see the document set there and note its configuration:
    image

  • Create a new (non-Microsoft 365-connected) Team Site "docsettest2"

  • Enable the management of Document Sets on site level

Now, in Powershell, connect to the site and execute:
Copy-PnPList -SourceListUrl "https://***.sharepoint.com/sites/docsettest/Source" -DestinationWebUrl "https://***.sharepoint.com/sites/docsettest2" -Title "Destination"

You'll see that the content type is not configured correctly (how do you even add an "Item" in a document library?)
image

What is the version of the Cmdlet module you are running?

2.12.0

Which operating system/environment are you running PnP PowerShell on?
  • Windows

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Copy-PnPList implementation and its cross-site content type handling, then reproduce the issue with the documented PowerShell command and Document Set setup. Done means a copied library retains the Document Set parent and configuration across sites, while same-site copying continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.