Share via

When create new document set, get error

Anonymous
2019-11-01T14:24:01+00:00

Split from this thread.

I have the same problem, with a custom document set and also when using the default document set with no extra meta data.

It might have something to do with the activation of the document set feature through a script. 

When I use a script (O365 CLI) to:

  • create site in script
  • enable document set feature in script 
  • apply site design (with a document set content type) in script

I get the mentioned error. 

If I do it this way:

  • create site in script
  • enable document set feature Manually 
  • apply site design in script 

it works

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2019-11-01T17:54:18+00:00

    Dear Jaap,

    I do a test with SharePoint Online PnP script and I can enable the Document Set feature in SharePoint Online and add the document set content type to the site library.

    If you haven’t tried the following script with SharePoint Online PnP, I suggest you try it to see the result.

    1. Enable the Document Set feature in a siote collection in SharePoint Online.

    #Config Variable

    $SiteURL = "https://tenantdomain.sharepoint.com/sites/sitecollectionname"

    $FeatureId = "featureid of Document Set" #Site Scoped Document Set Feature

    #Connect to PNP Online

    Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)

    #get the Feature

    $Feature = Get-PnPFeature -Scope Site -Identity $FeatureId

    #Get the Feature status

    If($Feature.DefinitionId -eq $null)

    {  

        #sharepoint online powershell enable feature

        Write-host -f Yellow "Activating Feature..."

        Enable-PnPFeature -Scope Site -Identity $FeatureId -Force

        Write-host -f Green "Feature Activated Successfully!"

    }

    Else

    {

        Write-host -f Yellow "Feature is already active!"

    }

    1. Create the Document Set content type in the group Custom Content Type in the site collection.

    $ParentCT = Get-PnPContentType -Identity “Document Set”

    Add-PnPContentType -Name "MyNewCT" -Description "New CT created with PnP" -Group "Custom Content Type" -ParentContentType $ParentCT

    1. Add the Document Set content type to the site library DocTest.

    $MyCT = "MyNewCT"

    Add-PnPContentTypeToList -List "DocTest" -ContentType $MyCT -DefaultContentType

    Meanwhile, as the issue only happens wjhen you create the Document Set content type with scripts and we have a specific platform MSDN forum coping with SharePoint scripts and customization related issues and questions, I suggest you post a new thread there for expert help.

    Best Regards,

    Cliff

    Was this answer helpful?

    0 comments No comments