문제

Adding If doc set does not exist then create doc set. What would be the syntax for looking up document set then create (if does not exists)

### Create new Document Set
$siteURL="http://intra.colgate.com/sites/vendors"
$docLib = "SOA"
$site=Get-SPSite $siteURL
$web=$site.RootWeb
$collFiles=$web.GetFolder($docLib).Files
$count=$collFiles.Count
while($count -ne 0)
{
$item = $collFiles[$count-1].Item
    $DocSetName = $item["Vendor"]
    $newDocumentSet = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($list.RootFolder,"Document Set Title",$cType.Id,$docsetProperties)
도움이 되었습니까?

해결책

I'm not sure if I'm answering the right question, but I used this method to check if Doc Set (folder) exists, and if not, create:

[Microsoft.SharePoint.SPFolder]$targetFolder = $rootWeb.GetFolder($targetDocLib.RootFolder.ServerRelativeUrl + "/$docSetName")

if (-not $targetFolder.Exists)
{
    # create
}

This approach worked for me.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top