VDS - Create project link for new files

VDS - Create project link for new files

Anonymous
Not applicable
762 Views
3 Replies
Message 1 of 4

VDS - Create project link for new files

Anonymous
Not applicable

Hello Guys,

 

i am looking for a way or rather for a command to create a link to an existing project folder for new files with Vault Data Standard. It could be through cascading combo boxes that reveal the actual project folder structure or by right clicking a project folder and clicking "create new data standard file" i.e.

I have a Year/Month file location and would like to enhance it by this "create project link" utility.

 

I'd be happy for any help/advice 🙂

 

Kind regards,

Jascha Helbig

0 Likes
Accepted solutions (1)
763 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

So apparently this is possible with this function, havn't tried it yet but will for sure and reply here again.

 

public Lnk AddLink(
   System.long parentId,
   System.string toEntityClassId,
   System.long toEntityId,
   System.string meta
)

AddLink($projectfolder.Id,“FILE“,$newfile.Id,$null)

0 Likes
Message 3 of 4

Markus.Koechl
Autodesk
Autodesk
Accepted solution

This is possible. However I don't have a sample to create links for files to folders. I would not recommend continue creating new files in date based folder structures. Vault is designed to create the files directly belonging to a project and link files for re-use in other projects if needed.

I can share a sample to create links on folder creation to and from custom objects; this should help to get the concept. Your suggested approach is quite close to this.

	#region create_links
	try
	{
		$companyID = Get-Content $env:TEMP"\mOrganisationId.txt"
		$contactID = Get-Content $env:TEMP"\mPersonId.txt"
		#if($companyID -ne "") { $link1 = $vault.DocumentService.AddLink($companyID,"FLDR",$dialog.CurrentFolder.Id,"Organisation->Folder") }
		if($companyID -ne $null) { $link2 = $vault.DocumentService.AddLink($dialog.CurrentFolder.Id,"CUSTENT",$companyID,"Folder->Organisation") }
		#if($contactID -ne "") { $link3 = $vault.DocumentService.AddLink($contactID,"FLDR",$dialog.CurrentFolder.Id,"Person->Folder") }
		if($contactID -ne $null) { $link3 = $vault.DocumentService.AddLink($dialog.CurrentFolder.Id,"CUSTENT",$contactID,"Folder->Person") }
	}
	catch
	{
		$dsDiag.Trace("CreateFolder.ps1 - AddLink command failed") 
	}
	finally {
		#in any case don't use the last entry twice...
		$null | Out-File $env:TEMP"\mOrganisationId.txt"
		$null | Out-File $env:TEMP"\mPersonId.txt"
	}
	#endregion

May I ask you switching to the Vault Customization forum for these types of discussions/questions for future posts? Thanks you.



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes
Message 4 of 4

Anonymous
Not applicable

Thank you very much for sharing this example and your thoughts. It should help quite a lot!

And i will switch the forum for future posts 🙂

0 Likes