0

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?

0

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

cls

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 – Gabriel Bravo Nov 10 '20 at 17:07
  • Glad to know that it worked for you. Please mark this question as answered if possible. – Matiur Rahman Nov 10 '20 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.