To set properties for the Document Set, and simple modification would be to include a key pair Hash table, the function declares an empty one ($dsProps)
Example would be:
[hashtable] $dsProps = @{"Key" = "Value";"Key" = "Value";}
or
$dsProps["Key"]="Value"
$dsProps["Key"]="Value"
The function:
function createDocumentSets([string]$SiteUrl, [string]$LibraryName, [string]$CTName, [string]$dsName)
{
[Microsoft.SharePoint.SPWeb]$oWeb = Get-SPWeb $SiteUrl
[Microsoft.SharePoint.SPList]$oLibrary = $oWeb.Lists[$LibraryName]
if($oLibrary.Title -eq $LibraryName)
{
[Microsoft.SharePoint.SPContentType]$oCT = $oLibrary.ContentTypes[$CTName]
if($oCT.Name -eq $CTName)
{
[Hashtable]$dsProps = @{}
[Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]$newDs =
[Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($oLibrary.RootFolder,
$dsName,$oCT.ID,$dsProps,$true)
Write-Host "`tCreating '$dsName' ($CTName) in Library '$LibraryName' @ '$SiteUrl'" } else { Write-Host "[ERROR] Getting Content Type '$CTName' on Library '$LibraryName' @ '$SiteUrl'" } } else { Write-Host "[ERROR] Getting Library '$LibraryName' @ '$SiteUrl'" } $oWeb.Dispose() }
[Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($oLibrary.RootFolder,
$dsName,$oCT.ID,$dsProps,$true)
Write-Host "`tCreating '$dsName' ($CTName) in Library '$LibraryName' @ '$SiteUrl'" } else { Write-Host "[ERROR] Getting Content Type '$CTName' on Library '$LibraryName' @ '$SiteUrl'" } } else { Write-Host "[ERROR] Getting Library '$LibraryName' @ '$SiteUrl'" } $oWeb.Dispose() }
No comments :
Post a Comment