-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVault_Folder_Structure_Export.ilogicvb
More file actions
37 lines (34 loc) · 2.28 KB
/
Vault_Folder_Structure_Export.ilogicvb
File metadata and controls
37 lines (34 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
AddReference "C:\Program Files\Autodesk\Vault Server 2024\ADMS Console\Autodesk.Connectivity.WebServices.dll"
Imports AWS = Autodesk.Connectivity.WebServices
AddReference "C:\Program Files\Autodesk\Vault Server 2024\ADMS Console\Autodesk.DataManagement.Client.Framework.Vault.dll"
Imports VDF = Autodesk.DataManagement.Client.Framework
AddReference "C:\Program Files\Autodesk\Vault Server 2024\ADMS Console\Connectivity.Application.VaultBase.dll"
Imports VB = Connectivity.Application.VaultBase
Sub Main()
'get active vaultconnection
Dim mVltCon As VDF.Vault.Currency.Connections.Connection = VB.ConnectionManager.Instance.Connection
'check if user is logged in
If mVltCon Is Nothing OrElse mVltCon.UserName Is Nothing OrElse mVltCon.UserName = "" Then
MessageBox.Show("Not Logged In to Vault! - Login first and repeat executing this rule.")
Exit Sub
End If
'get vault root folder
Dim root As VDF.Vault.Currency.Entities.Folder = mVltCon.FolderManager.RootFolder
'get full list of folders, using recurse parameter. Downselect to the folder name
Dim vaultPaths As IEnumerable(Of String) = mVltCon.FolderManager.GetChildFolders(root, True, False).Select(Function(c) c.FullName)
'modify vault paths into windows local paths
Dim localPaths As IEnumerable(Of String) = vaultPaths.Select(Function(c) c.Replace("$/", "C:\Workspace\").Replace("/", "\"))
Dim errs As New ArrayList
'make directories if not existing
For Each dr As String In localPaths
Try
If Not System.IO.Directory.Exists(dr) Then
System.IO.Directory.CreateDirectory(dr)
End If
Catch
errs.Add("Could not make folder: " & dr)
End Try
Next
'show errors if any
If errs.Count > 0 Then MsgBox(String.Join(vbCrLf, errs.ToArray))
End Sub