PromoteComponents Method
Creates items on a component-by-component basis.
Required Permissions
FilePromoteSyntax
public void PromoteComponents(
System.DateTime timestamp,
System.long[] compIds
)Public Sub PromoteComponents( _
ByVal timestamp As System.Date, _
ByVal compIds() As System.Long _
) Parameters
| Name | Description |
|---|---|
| timestamp | The timestamp value from the prior call to GetPromoteComponentOrder. |
| compIds | An array of component IDs to generate Items from. |
Example
using System;
using Autodesk.Connectivity.WebServices;
using Autodesk.Connectivity.WebServicesTools;
class VaultSDKSample
{
public static void PromoteTest(WebServiceManager serviceManager, long[] fileIds)
{
Item[] items = null;
try
{
serviceManager.ItemService.AddPromoteComponents(fileIds);
DateTime timestamp;
long[] compIds = serviceManager.ItemService.GetPromoteComponentOrder(out timestamp);
foreach (long compId in compIds)
{
serviceManager.ItemService.PromoteComponents(timestamp, new long[] { compId });
}
ItemsAndFiles result = serviceManager.ItemService.GetPromoteComponentsResults(timestamp);
items = result.ItemRevArray;
serviceManager.ItemService.UpdateAndCommitItems(items);
}
catch (Exception)
{
if (items != null)
{
foreach (Item item in items)
{
serviceManager.ItemService.UndoEditItems(new long[] { item.Id });
}
}
}
}
}Imports System
Imports Autodesk.Connectivity.WebServices
Class VaultSDKSample
Private Sub PromoteTest(serviceManager As Autodesk.Connectivity.WebServicesTools.WebServiceManager, fileIds As Long())
Dim items As Item() = Nothing
Try
serviceManager.ItemService.AddPromoteComponents(fileIds)
Dim timestamp As DateTime
Dim compIds As Long() = serviceManager.ItemService.GetPromoteComponentOrder(timestamp)
For Each compId As Long In compIds
serviceManager.ItemService.PromoteComponents(timestamp, New Long() {compId})
Next
Dim result As ItemsAndFiles = serviceManager.ItemService.GetPromoteComponentsResults(timestamp)
items = result.ItemRevArray
serviceManager.ItemService.UpdateAndCommitItems(items)
Catch generatedExceptionName As Exception
If items IsNot Nothing Then
For Each item As Item In items
serviceManager.ItemService.UndoEditItems(New Long() {item.Id})
Next
End If
End Try
End Sub
End Class