Vault folder structure sync

Vault folder structure sync

TYoung_Combi
Advocate Advocate
1,264 Views
4 Replies
Message 1 of 5

Vault folder structure sync

TYoung_Combi
Advocate
Advocate

Short of performing a 'get' from Vault, is there a way to synchronize the complete Vault folder structure to the local working folder?

Long story short, the Vault wasn't set up optimally where I work and I'm trying to remedy that, but in the interim I need an easy way to perform this sync.

0 Likes
1,265 Views
4 Replies
Replies (4)
Message 2 of 5

gandhey
Autodesk
Autodesk

Hello,

 

I guess you want to get the Vault folder structure without actually doing the Vault 'Get' command.

 

No, what you are looking for looks quite close to the idea in Vault ideastation:

https://forums.autodesk.com/t5/vault-ideas/get-full-vault-folder-structure/idi-p/8684458

If yes, please vote.

 

Regards,

Yogeshwar

(Vault team)

0 Likes
Message 3 of 5

TYoung_Combi
Advocate
Advocate

Yes, that is what I am looking for.  Thank you for the link to the 'ideas' page; I voted it up and added my own comments.

Message 4 of 5

greggeorgi
Contributor
Contributor

Hello there, I know this is somewhat old, but i found a need for having the folder tree as well. Since my company uses Inventor predominantly, i wrote an iLogic Rule to do just this and can be run by any user with Inventor+Vault. You or any other users that happen across this will just have to modify the local path to what you use.

 

If you don't have/use inventor, then it could be converted to a standalone application, vault extension, powershell script, or other,  would have to change the login code at the very least. However, my current knowledge is limited to running it through inventor and I have no need to expand it, so i wont convert it myself.

 

AddReference "Autodesk.DataManagement.Client.Framework.Vault.dll"
AddReference "Autodesk.DataManagement.Client.Framework.dll"
AddReference "Connectivity.Application.VaultBase.dll"

Imports VDF = Autodesk.DataManagement.Client.Framework
Imports VB = Connectivity.Application.VaultBase

'''''''''''''''''''''''''''''''''''''''
''' Author: greg
''''''''''''''''''''''''''''''''''''''' 

''' Syncs entire folder structure of vault to local workspace. Creates folders only, does not get any files

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

 

Message 5 of 5

davis.j
Advocate
Advocate

@greggeorgi  Thanks for your help, works wonderfully. 😎

0 Likes