In Vault 2015, PromoteFiles has been removed from the ItemService. Previously, the quickest way was to call PromoteFiles followed by UpdateAndCommitItems. Of course, more complex cases would require more API calls and data checks. Anyway, the simple workflow just got more complex in 2015. That’s sometimes the price you pay for better functionality.
Before I dive into the new code, let me explain the reason for the change. First, PromoteFiles was not very efficient. It tried to do the entire BOM at once, which is bad for server performance and scalability. Next, it favored a file-first workflow (the files need to get created before the items). In Vault 2015, there is much better support for item-first workflows, which I’ll go over in other articles.
For now, let’s go back to the simple file-first case. You have an Inventor assembly checked-in and you want to create the BOM in Vault.
Here is the code for doing that...
ItemService itemSvc = m_conn.WebServiceManager.ItemService;
itemSvc.AddFilesToPromote(fileIds, ItemAssignAll.Default, false);
GetPromoteOrderResults promoteOrder =
ItemsAndFiles itemsAndFiles =
// TODO: edit the items if needed
Dim itemSvc AsItemService = m_conn.WebServiceManager.ItemService
itemSvc.AddFilesToPromote(fileIds, ItemAssignAll.Default, False)
Dim timestamp AsDateTime
Dim promoteOrder As GetPromoteOrderResults = itemSvc.GetPromoteComponentOrder(timestamp)
Dim itemsAndFiles AsItemsAndFiles = itemSvc.GetPromoteComponentsResults(timestamp)
' edit the items as needed
Basically, PromoteFiles has been replaced by 4 function calls: AddFilesToPromote, GetPromoteComponentOrder, PromoteComponents, and GetPromoteComponentsResults. The "timestamp" variable is the thread that ties together the four calls. When you want to finalize the operation, call UpdateAndCommitItems just like before.
Yes, it seems like 4 function calls makes things worse than before. It's definitely more work for a client, but it makes and improvement on the server side. Less is done in a single call, which means that transactions are smaller and quicker. That, in turn, means more concurrency and throughput.