Vault Data Standard 2018 Folder Structure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
1. I'm trying to create option with Vault Data Standard to create a folder structure setected from template file (xaml). I found a solution on this page:
https://blog.coolorange.com/2014/10/17/create-folder-tree-from-a-template/
This Code work good but it need one additonal property ("Template").
My question is that can VDS do same without New property?
There is my modified code for create folder structure with one new property:
function recursivelyCreateFolders($childFolders, $newFolder,$folderCategories) { if($childFolders -eq $null) { return } $dsDiag.Trace(">> recursivelyCreateFolders($childFolders, $($newFolder.FullName))") foreach ($folder in $childFolders) { $newSubFolder = $vault.DocumentServiceExtensions.AddFolderWithCategory($folder.Name, $newFolder.Id, $false, $folderCategories[$folder.Category]) recursivelyCreateFolders -childFolders $folder.ChildNodes -newFolder $newSubFolder -folderCategories $folderCategories } $dsDiag.Trace("<< recursivelyCreateFolders") } $folderId=$vaultContext.CurrentSelectionSet[0].Id $vaultContext.ForceRefresh = $true $dialog = $dsCommands.GetCreateFolderDialog($folderId) $xamlFile = New-Object CreateObject.WPF.XamlFile "Device.xaml", "%ProgramData%\Autodesk\Vault 2018\Extensions\DataStandard\Vault\Configuration\Device.xaml" $dialog.XamlFile = $xamlFile $result = $dialog.Execute() $dsDiag.Trace($result) if($result) { #new folder can be found in $dialog.CurrentFolder $folder = $vault.DocumentService.GetFolderById($folderId) $path=$folder.FullName+"/"+$dialog.CurrentFolder.Name $newFolder = $vault.DocumentService.GetFolderByPath($path)
#Is there property insert?
$template = $dialog.ViewModel.Prop["Template"].Value if($template -ne "") { [xml]$xml = Get-Content "C:\ProgramData\Autodesk\Vault 2018\Extensions\DataStandard\Vault\Configuration\DeviceTemplates.xml" $folderTree = Select-Xml -Xml $xml -XPath "//Template[@Name='$template']" $folderCats = $vault.CategoryService.GetCategoriesByEntityClassId("FLDR",$true) $fc = @{} $folderCats | ForEach-Object { $fc[$_.Name]=$_.Id} recursivelyCreateFolders -childFolders $folderTree.Node.ChildNodes -newFolder $newFolder -folderCategories $fc } [System.Reflection.Assembly]::LoadFrom("C:\Program Files\Autodesk\Vault Professional 2018\Explorer\Autodesk.Connectivity.Explorer.Extensibility.dll") $selectionId = [Autodesk.Connectivity.Explorer.Extensibility.SelectionTypeId]::Folder $location = New-Object Autodesk.Connectivity.Explorer.Extensibility.LocationContext $selectionId, $path $vaultContext.GoToLocation = $location }
2. One more question about VDS is that, can I display some (not all) folder properties dependent what User choose in Create Folder Dialog Box of One property list [One property with multiple selection]. For example User choose [TYPE] is [Device_1] then on right show just [Device_1_property 1] and [Device_1_property 2], if User choose [TYPE] is [Device_2] then on right show [Device_2_property 1] and [Device_2_property 2]. Best if I can use to this a template file. Is that posible?