Question: I have a site collection that contains multiple sub sites with documents libraries inside. I need to update the documents set inside those libraries using code. It could be via CSOM, PowerShell or JSOM. I have tried multiples ways of updating properties of those Documents Set but it says "Content types that are available to the Document Set have been added or removed". CSOM Document Set helper functions only work with SP 2010 ?How could I update properties on a Document Set targeting SP Online using code?

1 Answer 1


Using PnP PowerShell, I was able to update the properties of Document Sets using the following script. You can modify to suit your needs


Import-Module -Name SharePointPnPPowerShellOnline -Verbose

#Config Variables
$SiteURL = "https://mytenant.sharepoint.com/sites/SPOSite/"
$ListName= "SourceDocSet" #Name of the Library
#Connect to PnP Online - Use this for UserID/Password
#Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential) 

#Use this to Login for multi-factor enabled tenant
Connect-PnPOnline -Url $SiteURL -SPOManagementShell

#examine the Internal names of the fields/columns
#Get-PnPField -List $ListName 

#update the properties of a DocumnetSet by providing new values. Here, 4=ID
Set-PnPListItem -List $ListName -Identity 4 -Values @{"CustomDocumentType"="Health Record"; "_Status" ="Draft"}

  • Thanks , it works! Have a nice day Nov 10, 2020 at 17:07
  • Glad to know that it worked for you. Please mark this question as answered if possible. Nov 10, 2020 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.