Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AddLink to Custom Object

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Eli_Dexter
167 Views, 1 Reply

AddLink to Custom Object

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?

Tags (3)
Labels (2)
1 REPLY 1
Message 2 of 2
Markus.Koechl
in reply to: Eli_Dexter

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... 



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report