A while back I posted some code showing how to create Items from Files. This time I’ll post code code showing how to update those Items when you want to consume File changes.
The code is almost identical. The creating Items from Files and updating Items from Files are actually the same operation under the hood. The only difference is how the process gets kicked off. When creating Items, you start with a set of Files. When updating Items, you start with a set of Items.
Here is the code for the update operation. This time around UpdatePromoteComponents kicks off the process. Again, this is a very simplified example. More complex BOMs may involve more code.
ItemService itemSvc = m_conn.WebServiceManager.ItemService; itemSvc.UpdatePromoteComponents(itemRevIds, DateTime timestamp; GetPromoteOrderResults promoteOrder = itemSvc.GetPromoteComponentOrder(out timestamp); itemSvc.PromoteComponents(timestamp, promoteOrder.PrimaryArray); ItemsAndFiles itemsAndFiles =
// edit the items as needed itemSvc.UpdateAndCommitItems(itemsAndFiles.ItemRevArray); |
Dim itemSvc AsItemService = m_conn.WebServiceManager.ItemService itemSvc.UpdatePromoteComponents(itemRevIds, _ Dim timestamp AsDateTime Dim promoteOrder As GetPromoteOrderResults = _ itemSvc.PromoteComponents(timestamp, promoteOrder.PrimaryArray) Dim itemsAndFiles AsItemsAndFiles = _ itemSvc.GetPromoteComponentsResults(timestamp)
' edit the items as needed itemSvc.UpdateAndCommitItems(itemsAndFiles.ItemRevArray) |