Apply-SPOProvisioningTemplate or Get-SPOProvisioningTemplate?I tried to create site with document set.
Document set content type was added successfully.
But when I opened document library and created new document set by click [Save] button on "NewDocSet.aspx", error message was displayed.
Sorry, something went wrong
The system cannot find the file specified. (Exception from HRESULT: 0x80070002))
Please confirm what it is that your reporting
Then opened the document library again, document set was created.
I should be able to create document set without error.

$TENANT = "TENANTNAME"
$SHAREPOINTADMINURL = "https://$TENANT-admin.sharepoint.com/"
$SHAREPOINTURL = "https://$TENANT.sharepoint.com"
$CONNECTID = "USER ID"
$CONNECTPASSWORD = "USER PASSWORD"
$NEWSITETITLE = "SITE TITLE";
$NEWSITEPATH = "$SHAREPOINTURL/sites/SITE PATH";
Import-Module SharePointPnPPowerShellOnline
$connectSecurePassword = ConvertTo-SecureString $CONNECTPASSWORD -asplaintext -force
$connectCredential = New-Object System.Management.Automation.PSCredential -argumentlist $CONNECTID, $connectSecurePassword
Connect-PnPOnline -Url $SHAREPOINTURL -Credential $connectCredential
New-PnPSite -Type CommunicationSite -Title $NEWSITETITLE -Url $NEWSITEPATH -Lcid 1033 -SiteDesign Blank
$connectSecurePassword = ConvertTo-SecureString $CONNECTPASSWORD -asplaintext -force
$connectCredential = New-Object System.Management.Automation.PSCredential -argumentlist $CONNECTID, $connectSecurePassword
Connect-PnPOnline -Url $NEWSITEPATH -Credential $connectCredential
$featureGuid = "3bae86a2-776d-499d-9db8-fa4cdc7884f8"
Enable-PnPFeature -Identity $featureGuid -Scope Site -Force
Set-PnPList -Identity "Documents" -EnableContentTypes $true
Add-PnPContentTypeToList -List "Documents" -ContentType "Document Set"
(you can retrieve this by executing Get-Module -Name *pnppowershell* -ListAvailable)
3.13.1909.0
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
When I had enabled document set by SharePoint Site Featrure GUI and used PowerShell PnP for other settings, the above error did not occur. So "Enable-PnPFeature" seems to be the cause.
I have also tested and I can confirm the same behaviour.
There is no way to enable document set feature from pnp-powershell or xml provisioning template. Well, better said, you CAN enable the feature, HOWEVER, when you try to create document set, you will get this error after file is saved :
_( cannot find the file specified. (Exception from HRESULT: 0x80070002) )_

or when you visit a docset related url
[site]/_layouts/15/DocSetHome.aspx?id=[docset_filepath]
you get the following error:

To conclude, if you manually disable the docset feature and, using the web ui, enable the feature again, everything goes fine.
Please could you provide a fix asap, this is an important issue for provisioning site processes. Thanks
I confirmed the following:
So I realized that this issue would not be resolved without server-side modifications.
Is there no choice but to wait for a fix? Or is there any other way to tell Microsoft about the fix?
I found a solution in case you want to enable the "docset feature" either from pnp-powershell or CSOM ( you wont success to enable this from a provisioning template, since it wont work).
Basically, you need to enable "custom scripts" before enable the docset feature by a script.
Therefore, in case you need to enable this feature using pnp powershell, your code should implement something like this:
$tenant= [yourtenant]
$site_url= [yousite]
$user & $psswd= [login params]
$credentials = getCredentials -user $user -pswd $psswd
$connected = connect-pnponline -url $($tenant.replace(".sharepoint.com", "-admin.sharepoint.com")) -credentials $credentials
$context = Get-PnPContext
Write-host "Enabling site scripts on target site..." -ForeGroundColor Yellow
$site = Get-PnPTenantSite -Detailed -Url "$tenant$site_url"
$DenyAddAndCustomizePagesStatusEnum = [Microsoft.Online.SharePoint.TenantAdministration.DenyAddAndCustomizePagesStatus]
$site.DenyAddAndCustomizePages = $DenyAddAndCustomizePagesStatusEnum::Disabled
$site.Update()
$context.ExecuteQuery()
Write-Host "OK: site sidescripts has enabled" -ForeGroundColor Green
Write-host "Enabling docset feature on target site..." -ForeGroundColor Yellow
$connected = spConnect -tenant $tenant -site $site_url -credentials $credentials
$featureGuid = "3bae86a2-776d-499d-9db8-fa4cdc7884f8"
Enable-PnPFeature -Identity $featureGuid -Scope Site -Force
Write-Host "OK: site docset feature has been enabled" -ForeGroundColor Green
Sources :
Remember, you need to enable the custom site scripts before enabling the docset feature, if you do it the other way around, it wont work.
I think Microsoft should add some validation regarding the missing required settings, when using CSOM/pnpPowershell/xml templates.
Thanks for your advice.
When I had created new site manually and set "DenyAddAndCustomizePages" and enabled document set feature with the above command, I could create document set without error.
But when I try to do everything with PnP Powershell as shown below, the error will still occur.
$TENANT = "TENANTNAME"
$SHAREPOINTADMINURL = "https://$TENANT-admin.sharepoint.com/"
$SHAREPOINTURL = "https://$TENANT.sharepoint.com"
$CONNECTID = "USER ID"
$CONNECTPASSWORD = "USER PASSWORD"
$NEWSITETITLE = "SITE TITLE";
$NEWSITEPATH = "$SHAREPOINTURL/sites/SITE PATH";
Import-Module SharePointPnPPowerShellOnline
$connectSecurePassword = ConvertTo-SecureString $CONNECTPASSWORD -asplaintext -force
$connectCredential = New-Object System.Management.Automation.PSCredential -argumentlist $CONNECTID, $connectSecurePassword
Connect-PnPOnline -Url $SHAREPOINTURL -Credential $connectCredential
New-PnPSite -Type CommunicationSite -Title $NEWSITETITLE -Url $NEWSITEPATH -Lcid 1033 -SiteDesign Blank
$context = Get-PnPContext
$site = Get-PnPTenantSite -Detailed -Url $NEWSITEPATH
$DenyAddAndCustomizePagesStatusEnum = [Microsoft.Online.SharePoint.TenantAdministration.DenyAddAndCustomizePagesStatus]
$site.DenyAddAndCustomizePages = $DenyAddAndCustomizePagesStatusEnum::Disabled
$site.Update()
$context.ExecuteQuery()
$connectSecurePassword = ConvertTo-SecureString $CONNECTPASSWORD -asplaintext -force
$connectCredential = New-Object System.Management.Automation.PSCredential -argumentlist $CONNECTID, $connectSecurePassword
Connect-PnPOnline -Url $NEWSITEPATH -Credential $connectCredential
$featureGuid = "3bae86a2-776d-499d-9db8-fa4cdc7884f8"
Enable-PnPFeature -Identity $featureGuid -Scope Site -Force
Set-PnPList -Identity "Documents" -EnableContentTypes $true
Add-PnPContentTypeToList -List "Documents" -ContentType "Document Set"
Something still seems to be missing ...
I knew what was wrong, so I correct it and close issue.
In the previous post, I could not change the "DenyAddAndCustomizePages" settings because I didn't connect to the Administration Center. The following command worked as expected.
Thank you very much, Alberto.
$TENANT = "TENANTNAME"
$SHAREPOINTADMINURL = "https://$TENANT-admin.sharepoint.com/"
$SHAREPOINTURL = "https://$TENANT.sharepoint.com"
$CONNECTID = "USER ID"
$CONNECTPASSWORD = "USER PASSWORD"
$NEWSITETITLE = "SITE TITLE";
$NEWSITEPATH = "$SHAREPOINTURL/sites/SITE PATH";
Import-Module SharePointPnPPowerShellOnline
$connectSecurePassword = ConvertTo-SecureString $CONNECTPASSWORD -asplaintext -force
$connectCredential = New-Object System.Management.Automation.PSCredential -argumentlist $CONNECTID, $connectSecurePassword
Connect-PnPOnline -Url $SHAREPOINTURL -Credential $connectCredential
New-PnPSite -Type CommunicationSite -Title $NEWSITETITLE -Url $NEWSITEPATH -Lcid 1033 -SiteDesign Blank
Connect-PnPOnline -Url $SHAREPOINTADMINURL -Credential $connectCredential
$context = Get-PnPContext
$site = Get-PnPTenantSite -Detailed -Url $NEWSITEPATH
$DenyAddAndCustomizePagesStatusEnum = [Microsoft.Online.SharePoint.TenantAdministration.DenyAddAndCustomizePagesStatus]
$site.DenyAddAndCustomizePages = $DenyAddAndCustomizePagesStatusEnum::Disabled
$site.Update()
$context.ExecuteQuery()
Connect-PnPOnline -Url $NEWSITEPATH -Credential $connectCredential
$featureGuid = "3bae86a2-776d-499d-9db8-fa4cdc7884f8"
Enable-PnPFeature -Identity $featureGuid -Scope Site -Force
Set-PnPList -Identity "Documents" -EnableContentTypes $true
Add-PnPContentTypeToList -List "Documents" -ContentType "Document Set"