I am trying to Create links from File(s) to Custom Object (equivalent to Copying File and pasting as Link to Custom Object) thru Vault API (and PowerVault).
I have found an AddLink method, however, when I am trying to use it:
$vault.DocumentService.AddLink($file.MasterId, "CUSTENT", $custObj.Id, "Test")
I am getting an error:
Exception calling "AddLink" with "4" argument(s): "109"
+ $vault.DocumentService.AddLink($file.MasterId, "CUSTENT", $custObj.Id ...
What am I doing wrong?
Solved! Go to Solution.
Solved by Markus.Koechl. Go to Solution.
It would be best if you swapped parent/child: A file can be linked to a custom object and listed in the Content view of the Custom Object. The file's Where Used will list the object also if you expand the parent filter.
My VDS sample configuration has (disabled) sample code to link classified components to classes (=Custom Objects):
$link = $vault.DocumentService.AddLink($parentID,"FILE", $childID, "Parent->Child")
parentID = Id of the custom object
"FILE" = the entity type to be linked
childID = the latest file iteration of the file
You can review the full context, including managing to add or update an existing link here: VDS-Sample-Configurations-2024/VDS-PDMC-Sample/Vault.Custom/addinVault/Menus/ADSK.QS.EditFile.ps1 at...
Can't find what you're looking for? Ask the community or share your knowledge.