Forum Discussion

MBNielsen's avatar
MBNielsen
Copper Contributor
May 22, 2019

PnP issue on SPO DocumentSet

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

 

  • MichaelK408's avatar
    MichaelK408
    Copper Contributor
    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.

Resources