magritton
6/5/2014 - 7:31 PM

This creates a new document set in SharePoint 2013. You must have the content type enabled. The example below uses a document set name of "T

This creates a new document set in SharePoint 2013. You must have the content type enabled. The example below uses a document set name of "Test"

#Script settings
$webUrl = "http://portal.opwftg.com/sites/OPWSS/Teams/Acq/Project BlueJacket"
$listName = "Diligence"
 
### Get web and list
$web = Get-SPWeb $webUrl
$list = $web.Lists[$listName]
 
### Get Document Set Content Type from list
$cType = $list.ContentTypes["Document Set"]
 
### Create new Document Set
[Hashtable]$docsetProperties = @{}
 
$newDocumentSet = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($list.RootFolder,"Test",$cType.Id, $docsetProperties)
write-host "Test ... created"

$web.Dispose()