1

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)
2
  • Did you guys change the site look n feel? Is it still a php site? Commented Sep 13, 2011 at 21:34
  • our beta design is gone as of tonight as we soon will be moving out of beta. Please keep this kind of comments on meta :-) Commented Sep 13, 2011 at 21:42

1 Answer 1

3

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.

1
  • Thanks for posting the code. I will try it tomorrow. Thanks again Commented Sep 13, 2011 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.