CSV values not applying when Doument Set Created

Copper Contributor

I am attempting to create Document Sets from powershell running the below code. The doc sets are created with Title and name but the other fields are not getting their values from the csv, at a loss why the csv values are not being applied. Thanks in advance for any help

 

$ErrorActionPreference = "Stop"
$ver = $host | select version
if($Ver.version.major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"}
if(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ea 0))
{
Write-Progress -Activity "Loading Modules" -Status "Loading Microsoft.SharePoint.PowerShell"
Add-PSSnapin Microsoft.SharePoint.PowerShell
}

$DestinationWebURL = "https://myweb.mine.com/custmgmt"
$DestinationLibraryTitle = "Customers"
$docSetInfos = Import-CSV C:\Users\Farm\Desktop\customerstest.csv -Header 'Title','Name','Description','CustCode','CustNam' -Delimiter ","

$dWeb = Get-SPWeb $DestinationWebURL
$dList = $dWeb.Lists | ? {$_.title -like $DestinationLibraryTitle}

$cType = $dList.ContentTypes["Customer"]

foreach($docSetInfo in $docSetInfos)
{
#Build properties hash table from $docSetInfos[]
$docsetProperties = @{}

$docsetProperties.Add('Title',$docSetInfo.Title)
$docsetProperties.Add('Name',$docSetInfo.Name)
$docsetProperties.Add('Description',$docSetInfo.Description)
$docsetProperties.Add('Customer Code',$docSetInfo.CustCode)
$docsetProperties.Add('Customer Name',$docSetInfo.CustName)

$NewFolder = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($dlist.RootFolder,$docSetInfo.CustCode, $cType.Id, $docsetProperties)
}

2 Replies

@ccroasmun67  The hashtable is loading because I can change the value in the Name column by changing the column variable in the create statement at the bottom of the script. To clarify, Title and Name get values, Description, CustCode, and CustName do not load data. Also this is SharePoint 2019, I know DocSet internal field names were changed in 2013, I am researching that.

Internal Column Name was the issue, Thanks to those who at least looked!!