Modernizing the Document Set `NewDocSet` Form

Microsoft modernized Document Sets a few years ago – sort of. They really didn’t finish the job, and they seem to be under the impression that few people use Document Sets. Everyone I know who understands good Information Architecture (IA) knows about Document Sets, and they use them when they make sense – which can be frequently.

Microsoft stopped the modernization process without modernizing the NewDocSet form. If you don’t use these scripts (there’s no way to do this in the user interfaces), the NewDocSet form will look something like this. It’s classic and unattractive, though it does work just fine.

Wouldn’t this be nicer, though? It fits into the modern UI and acts more like all other NewForms.

Best of all, you can now apply formatting to the modern form: adding to the header, rearranging columns, putting a link in the footer etc. That’s because the form is now modern!

One of the bright bulbs in the community, Dan Toft – @dan-toft.dk‬ on BlueSky – figured out a way to “modernize” the NewDocSet form for Document Sets and posted a script sample to the Script Samples | PnP Samples called Enable modern creation forms for Document sets.

Dan’s sample works perfectly well when you want to modernize a Content Type which has been enabled in a specific Document Library. I wanted to modernize a bunch of Document Sets, though, and I had defined them in the Content Type Hub – which is still where Content Types end up when you define them in the modern Content Type Gallery.

I adapted Dan’s good work to list out the Content Types in the Content Type Hub which inherit from Document Set, enable you to choose one, change the setting to make the NewDocSet form modern, and if you want, publish the result.

Here’s the resulting PowerShell script:

$tenant = "YourTenantName"
$clientId = "YourAppRegistrationGUID"

$cthConnection = Connect-PnPOnline -ClientId $clientId -Url "https://$($tenant).sharepoint.com/sites/ContentTypeHub" -Interactive

# Get the "Document Set" content types
$cts = Get-PnPContentType | Where-Object { $_.Id.StringValue.StartsWith("0x0120D520") }

foreach ($ct in $cts) {
    $currVal = "❌"
    if($ct.NewFormClientSideComponentId.Length -eq '') {
        $currVal = "✅"
    }
    Write-Host "[$($cts.IndexOf($ct)+1)] $($ct.name) $($currVal)"
}

$CTindex = Read-Host -Prompt "Which content type to you wish to modernize"

# Null out the NewFormClientSideComponentId as that seems to bring it to modern UI
$cts[$CTindex - 1].NewFormClientSideComponentId = $null;
$cts[$CTindex - 1].Update($false);

Invoke-PnPQuery

$ctPub = Read-Host -Prompt "Content Type $($cts[$CTindex-1].Name) updated. Would you like to publish the change? (Y/N)"
if ($ctPub -ne 'Y' -and $ctPub -ne 'y') {
    Write-Host -ForegroundColor Red "Exiting without publishing changes."
    exit
}
else {
    # Publish the changed content type
    Write-Host -ForegroundColor Yellow "Publishing content type $($cts[$CTindex-1].Name) with ID $($cts[$CTindex-1].Id)"
    Publish-PnPContentType -ContentType $cts[$CTindex - 1].Id
}

Write-Host -ForegroundColor Green "All done"

When you run the script, you’ll see something like this:

The Document Set Content Types are listed, showing whether or not the NewDocSet form has been modernized already. ✅ means it has been, ❌ means it has not been.

After choosing the Document Set Content Type you want, you’re prompted to ask if you’d like to publish it. I can think of scenarios when you would (I’m done setting it up) – and when you wouldn’t (I’m still working on it) – so I made it an option.

Here’s hoping this script proves useful to you. I’ll be sure to submit it to the Script Samples | PnP Samples, too. Whenever you’re starting a script, be sure to check for a good sample to start with there.


IMPORTANT CAVEAT [Added 2025-07-23]

Today I wanted to revert this change on a Content Type which inherits from Document Set. Unfortunately, between Dan and me both hammering on it, we couldn’t come up with a way to make it work. One would think that replacing the NewFormClientSideComponentId property for the Content Type with the default value it had in it before would be the way to revert the change. For whatever reason – and it’s possible there’s some encoding trick we missed – this doesn’t work.

Similar Posts

5 Comments

  1. This is a great find, shout out to Dan Toft – @dan-toft.dk‬ for sharing and Marc for syndicating.
    I’d be really keen to find out from MSFT if this is fine to do. I’ll do some of my own testing, for example see what happens when you attempt to customise the welcome page of the Document Set.
    It is a real shame that they didnt continue with modernisation, the position i thought MSFT had taken was , no one seems to want to use Document Sets as no one has raised it in user voice, whereas everyone was waiting for them to modernise it and didnt think that it needed to be raised in user voice as it was expected that they’d get to it eventually as such a useful feature wouldn’t be overlooked.

  2. This is a good post. You’re sort of right, it’s not that Microsoft is unaware of the usage, it’s that the usage levels, at present, really aren’t enough to justify rebalancing the dev investments to finish the job with document sets.

    It’s great to see that you all have figured out a community solution to take care of what Microsoft shouldn’t prioritize (yet).

    I love document sets.Thanks again.

  3. Hi Marc,

    After modernizing Document Sets, we found that they are no longer sorted correctly in alphabetical order. During investigation, we discovered a hidden, read-only field named SortBehavior, which determines how Document Sets are sorted in relation to folders and files.

    On a clean tenant, the default SortBehavior value for a Document Set is 0. After applying the modernization script (with a null value for NewFormClientSideComponentId), newly created Document Sets are stamped with SortBehavior = 1, which changes how they appear in sorted views.

    The larger issue is that when a Document Set is copied, moved, or versioned, SharePoint automatically reverts its SortBehavior value to 0. This causes the affected Document Sets to lose their folder-like behavior and disrupts alphabetical sorting, especially when “folders on top” is enabled.

    This quickly becomes a large-scale issue in production environments with thousands of Document Sets. Because the SortBehavior field is sealed and read-only, there is currently no way -AFAIK- to restore the correct value.

    I would also like to revert the changes introduced during modernization so that new Document Sets receive the correct default SortBehavior value again. Is that possible?

    Best regards,
    Bastiaan

Leave a Reply to Jonthan Stuckey Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.