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: 

Get the attached files from Change Order

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
meck
652 Views, 4 Replies

Get the attached files from Change Order

I'm new to Vault programming so be gentle!

 

Using vb.net I'm trying to get all of the files attached to a change order. I am able to get the change order using the code below, but I do not know how to retrieve the files from it. I've searched everywhere but cannot find an answer. Can someone please help?

 

 

 

Dim ECO As ChangeOrder = COService.GetChangeOrderByNumber(ECONo)

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
4 REPLIES 4
Message 2 of 5
minkd
in reply to: meck

To get the file records for a change order, use the GetAssociationsByChangeOrderIDs() method in the ChangeOrder service, passing "FILE" as the entityClassId parameter.

 

-Dave



Dave Mink
Fusion Lifecycle
Autodesk, Inc.
Message 3 of 5
meck
in reply to: minkd

Thanks for your reply!!!!

 

I'm sorry I don't have a clue what to do with the ChangeOrderEntAssoc that is returned from GetAssociationsByChangeOrderIDs. I've tried everything I can think of to iterate through the array and nothing seems to return the file names associated with the change order. What am I missing?

Here is the code so far...

 

Public Function GetECOFileNames(ByVal coSvc AsChangeOrderService, ByVal ChangeOrderNo AsString, ByVal docServ AsDocumentService) AsString()

 

Dim ECO AsChangeOrder= coSvc.GetChangeOrderByNumber(ChangeOrderNo)

  

Dim ECOs(0) AsLong

ECOs(0) = ECO.Id

Dim ECOAssoc() AsChangeOrderEntAssoc

ECOAssoc = coSvc.GetAssociationsByChangeOrderIDs(ECOs, "FILE")

 

Dim EntAssoc AsChangeOrderEntAssocDim i AsInteger

ForEach EntAssoc InECOAssoc

 ForEach EntID AsLongInEntAssoc.EntIdArray

 Dim oFile() AsFile= docServ.GetFilesByMasterId(EntID)

Next

Next

 

GetECOFileNames = ?

EndFunction

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
Message 4 of 5
minkd
in reply to: meck

The entity IDs in the return from the GetAssociationsByChangeOrderIDs call are not master IDs. A master ID represents all versions of a file, while the regular ID (some times referred to as the IterationId) represents a specific version of a file. The methods that require masterIDs typically mention "MasterId" in the method name and/or the parameter name.

 

So the correct call to get the file objects from those IDs is either GetFilesByIds() or GetLatestFilesByIds(), depending on what is more appropriate for your workflow.

 

There are two names in the file objects: Name and VerName.  The Name is the filename that Vault will download the file to (the name of the latest version), and the VerName is the name the file had at a specific version. The two are the same for the Latest File.

 

-Dave



Dave Mink
Fusion Lifecycle
Autodesk, Inc.
Message 5 of 5
meck
in reply to: minkd

Great explaination!

Thanks so much.

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018

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

Post to forums  

Autodesk Design & Make Report