I have been trying to create multiple Document Sets using Powershell from a csv file.
The script creates the Document Sets with the correct Name but doesnt set them up with the Metadata needed for the document set.
For example
I am creating 100 document sets - Each with a Unique Name and should have certain properties populated at creation. Project Number Project Lead Porfolio Lead
However i cannot get the 3 fields above to populate in the Respective Columns even though they are part of the content type for the Document Set.
$csv = import-csv C:\Projects.csv
#Script settings
$webUrl = "http://spprojects/"
$listName = "New Doc Set"
### Get web and list
$web = Get-SPWeb $webUrl
$list = $web.Lists[$listName]
### Get Document Set Content Type from list
$cType = $list.ContentTypes["MY Doc Set"]
# Create desired number of subfolders
foreach ($line in $csv)
{
$pn = $line.PorfoiloLead
$PPn = $line.ProjectLead
$name = $line.ProjectNumber
[Hashtable]$docsetProperties = @{}
$docsetProperties.add('PortfolioLead',$pn)
$docsetProperties.add('ProjectLead',$ppn)
$newDocumentSet = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($list.RootFolder,$Name,$cType.Id, $docsetProperties)
write-host "$name ... created"
}
$web.Dispose()
I have tried the example script located at http://www.the-north.com/sharepoint/post/Create-Multiple-Document-Sets-with-Powershell and that has the same behaviour of creating the Doc Sets but not importing the data into the columns for the Document set.
However i can see when I look to call the Doc Set Properties that it has been set there - however this is not displaying at all in the Library when i view it in the browser.
Hopefully I'm just having a bad day (or 2) and this is a relatively simple issue.
Thanks in advance