Open CatoAntonsen opened 7 years ago
If it helps, I've created document sets using Add-PnPListItem/Add-SPOListItem in the past and I found that it worked.
@Pieter-Veenstra, did you manage to add a Document Set to a document library? I get an error message saying I have to "... use SPFileCollection.Add()"
I am seeing the same issue. When I get the list item for the newly created document set, the symptoms I am seeing is that the HTML_x0020_File_x0020_Type
field is set to SharePoint.DocumentSet
as expected but this is not reflected in the ProgId
field. The content type is set correctly.
When I create a document set manually in SP Online, the ProgId field is also set to SharePoint.DocumentSet
. The ProgId
field is read only via the CSOM.
I noticed the same thing happen when I create the document set using CSOM in PowerShell:
[Microsoft.SharePoint.Client.DocumentSet.DocumentSet]::Create($ctx, $folder, $projectname, $ct.Id)
$ctx.ExecuteQuery()
@CatoAntonsen , Did you find reason for this issue or workaround for modern views? @ovenmorris I see that changing HTML_x0020_File_x0020_Type is reflected to ProgId on item.
While this is old and the cmdlet names have changed, the behavior hasn't. If anyone else runs across this, I was able to work around it by grabbing the ContentType off the library first, then using it as an argument as such: $ct = Get-PnPContentType -List 'Documents' -Identity 'Document Set' Add-PnPDocumentSet -List 'Documents' -ContentType $ct -Name 'SetName'
Hope this helps someone...
Thanks @bobtheslob, worked for us.
Hi @bobtheslob creating the document set this way works (it did not work before I tried this), but I get 404 file not found when I try and access the document set.
@bobtheslob this works! Thank you
I ran into this issue as well. The workaround of @bobtheslob does work, but it needs to work intuitively without having to know this workaround. I've submitted PR https://github.com/SharePoint/PnP-PowerShell/pull/1632 in which this will work without any workarounds so this issue can be closed once it gets merged.
Thanks @bobtheslob! I had pretty much the exact thing except I was missing -List on my Get-PnPContentType line. That made all the difference between a folder and a document set being created.
@tanwedar you still encountered this issue with a recent version of PnP PowerShell which included my PR?
Correct, it was happening earlier this week and this morning was when I saw @bobtheslob's post. I can pull once again if you want.
@tanwedar, that's funny as I thought I managed to fix it. Can you provide the exact PowerShell commands you used when it went wrong?
Of course. As far as I can remember was the same exact as when it went right, except the -List.
$ct = Get-PnPContentType -Identity "<content type>"
vs
$ct = Get-PnPContentType -Identity "<content type>" -List "<list>"
Reporting an Issue or Feature
It's an issue, but not 100% sure where the problem lies.
Expected behavior
Running Add-SPODocumentSet -Name "Test document set" -List "Test list" -ContentType "Documentsett" (NB! Content type is the Norwegian name for "Document Set".
A document set should be created and I should be able to click it to view the welcome page with the properties and documents.
Actual behavior
The document set that is created looks like an folder with an folder icon. The content type is correct (Dokumentsett). If I click this folder, I go into the empty folder instead of seeing the document set welcome page.
This only happens when modern view is enabled on the library. If I enable classic view, the behavior is as expected.
The strange thing is that if I manually create the document set (with modern view enabled), it created correctly. So there is "something" different when creating using the PowerShell command.
Steps to reproduce behavior
I've not included the variable names as they would vary. The name of the content type is in Norwegian and you might have to change that.
Which version of the PnP-PowerShell Cmdlets are you using?
What is the version of the Cmdlet module you are running?
(you can retrieve this by executing
Get-Module -Name *pnppowershell* -ListAvailable
)2.10.1612.0
How did you install the PnP-PowerShell Cmdlets?