Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Add-PnPDocumentSet not working with content type Id #1710

Closed
2 of 5 tasks
ThomasContini opened this issue Mar 22, 2022 · 2 comments · Fixed by #1796
Closed
2 of 5 tasks

[BUG] Add-PnPDocumentSet not working with content type Id #1710

ThomasContini opened this issue Mar 22, 2022 · 2 comments · Fixed by #1796
Assignees
Labels
bug Something isn't working

Comments

@ThomasContini
Copy link

Reporting an Issue or Missing Feature

Issue

Expected behavior

Following the current documentation here: https://pnp.github.io/powershell/cmdlets/Add-PnPDocumentSet.html

-ContentType
The name of the content type, its ID or an actual content object referencing to the document set

I should be able to create a document set thanks to its content type Id.

Actual behavior

$listId = "171cdda2-0a71-4da1-84e0-6b1111ede026"
$contentTypeId = "0x0120D520007A7337A21B195D4F81F0CD038E2E681404" 
Add-PnPDocumentSet -List $listId -Name "my-docset" -ContentType $contentTypeId 

Add-PnPDocumentSet cmdlet returns an error:

Add-PnPDocumentSet: Object reference not set to an instance of an object on server. The object is associated with method GetById.

But works like this: (By mentionning the content object directly, and not its ID)

$contentType = Get-PnPContentType -Identity "MyWonderfulCT"
Add-PnPDocumentSet -List $list.Id -Name "a-docset" -ContentType $contentType

Steps to reproduce behavior

  1. Connect to a site with Connect-PnPOnline
  2. Be sure that document set feature is enabled on your site
    Get-PnPFeature -Scope Site -Identity "3bae86a2-776d-499d-9db8-fa4cdc7884f8"
  3. Create a list, activate content types on it and link a document set content type to it
  4. Try to create a document set programmatically using its content type ID.

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

1.9.48 - nightly

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

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
@ThomasContini ThomasContini added the bug Something isn't working label Mar 22, 2022
@gautamdsheth gautamdsheth self-assigned this Apr 22, 2022
gautamdsheth added a commit to gautamdsheth/powershell that referenced this issue Apr 22, 2022
@gautamdsheth
Copy link
Collaborator

@ThomasContini - thanks for raising the issue. We managed to figure out and fix it :)

The fixed version will be available in tomorrow's nightly and afterwards !

@ThomasContini
Copy link
Author

Thanks a lot for the feedback! ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants