PnP issue on SPO DocumentSet

%3CLINGO-SUB%20id%3D%22lingo-sub-632615%22%20slang%3D%22en-US%22%3EPnP%20issue%20on%20SPO%20DocumentSet%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-632615%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3EI%20am%20struggeling%20with%20an%20PnP%20issue%20on%20Documents%20Sets.%20I%20need%20to%20update%20the%20property%20values%20on%20the%20Document%20Set%20shared%20properties%20as%20well%20as%20properties%20in%20documents%20(with%20different%20content%20types)%20inside%20the%20Document%20Set%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20somthing%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24docs%20%3D%20Get-PnPListItem%20-web%20%24subsiteurl%20-List%20%24TargetListID%3C%2FP%3E%3CP%3Eforeach%20(%24item%20in%20%24docs)%7B%3C%2FP%3E%3CP%3E%24spfile%20%3D%20Set-PnPListItem%20-List%20%24TargetListID%20-Identity%20%24item.Id%20-Values%20%40%7B%22xx%22%3D%22%24xx%22%7D%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%24spfile%20%3D%20Set-PnPListItem%20-List%20%24TargetListID%20-Identity%20%24item.Id%20-Values%20%40%7B%22yy%22%3D%22%24yy%22%7D%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3Eetc%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20do%20get%20the%20List%2Fibrary%20items%20including%20the%20Document%20Set%20folder%2C%20but%20it%20is%20NOT%20able%20to%20Set-PnPListItem%20values%2C%20I%20get%20no%20errors%20when%20running%20the%20powershell%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20did%20this%20on%20SP2013%20on-premise%20with%20no%20problem%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24weburl%20%3D%20%24_%5B'TargetSiteURL'%5D%3CBR%20%2F%3E%24web%20%3D%20Get-SPWeb%20-Identity%20%24weburl%3CBR%20%2F%3E%24list%20%3D%24web.lists%5B%22TagetlistName%22%5D%3C%2FP%3E%3CP%3Eforeach(%24item%20in%20%24list.folders)%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%7B%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%24item%5B%22xx%22%5D%3D%24_%5B'xx'%5D%3CBR%20%2F%3E%24item%5B%22yy%22%5D%3D%24_%5B'yy'%5D%3CBR%20%2F%3Eetc%3C%2FP%3E%3CP%3E%24item.update()%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20Post%20if%20you%20have%20a%20hint%20to%20a%20solution...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EAnyone%20with%20input%20%3A)%3C%2Fimg%3E%20%3F%3F%20much%20appreciated%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%2F%20MBNielsen%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-632615%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2336164%22%20slang%3D%22en-US%22%3ERe%3A%20PnP%20issue%20on%20SPO%20DocumentSet%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2336164%22%20slang%3D%22en-US%22%3EI'm%20doing%20something%20similar%20with%20Document%20Sets%20and%20custom%20content%20type%20and%20I've%20been%20successful%20updating%20properties%20with%20this%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%24newDS%20%3D%20Add-PnPDocumentSet%20-List%20FixedAssetDocs%20-ContentType%20FixedAssetDocSet%20-Name%20%22%24dsTitle%22%3CBR%20%2F%3E%24addedDS%20%3D%20%24web.GetFolder(%24newDS)%3CBR%20%2F%3E%24addedDS.SetProperty(%22Title%22%2C%24dsTitle)%3CBR%20%2F%3E%24addedDS.SetProperty(%22ol_Department%22%2C%22%24Department%22)%3CBR%20%2F%3E%24addedDS.SetProperty(%22DateAcquired%22%2C%22%24DateAcquired%22)%3CBR%20%2F%3Eetc..%3CBR%20%2F%3E%24addedDS.Update()%3CBR%20%2F%3E%24list.update()%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20works%20fine%20with%20the%20exception%20of%20the%20%22DateAcquired%22%20field%20and%20another%20text%20field.%20I've%20verified%20internal%20field%20names%20and%20all%20of%20that%20and%20still%20can't%20get%20those%20two%20fields%20to%20update.%3C%2FLINGO-BODY%3E
Visitor

Hi

I am struggeling with an PnP issue on Documents Sets. I need to update the property values on the Document Set shared properties as well as properties in documents (with different content types) inside the Document Set

 

I tried somthing like this:

 

$docs = Get-PnPListItem -web $subsiteurl -List $TargetListID

foreach ($item in $docs){

$spfile = Set-PnPListItem -List $TargetListID -Identity $item.Id -Values @{"xx"="$xx"} 
$spfile = Set-PnPListItem -List $TargetListID -Identity $item.Id -Values @{"yy"="$yy"} 
etc

 

I do get the List/ibrary items including the Document Set folder, but it is NOT able to Set-PnPListItem values, I get no errors when running the powershell

 

I did this on SP2013 on-premise with no problem like this:

 

$weburl = $_['TargetSiteURL']
$web = Get-SPWeb -Identity $weburl
$list =$web.lists["TagetlistName"]

foreach($item in $list.folders) 
{ 
$item["xx"]=$_['xx']
$item["yy"]=$_['yy']
etc

$item.update()

 

Please Post if you have a hint to a solution...

 

Anyone with input :) ?? much appreciated

 

/ MBNielsen

 

1 Reply
I'm doing something similar with Document Sets and custom content type and I've been successful updating properties with this:

$newDS = Add-PnPDocumentSet -List FixedAssetDocs -ContentType FixedAssetDocSet -Name "$dsTitle"
$addedDS = $web.GetFolder($newDS)
$addedDS.SetProperty("Title",$dsTitle)
$addedDS.SetProperty("ol_Department","$Department")
$addedDS.SetProperty("DateAcquired","$DateAcquired")
etc..
$addedDS.Update()
$list.update()

This works fine with the exception of the "DateAcquired" field and another text field. I've verified internal field names and all of that and still can't get those two fields to update.