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