My code currently looks like one of these two options if you could tell me I'm on the right track or not it would be greatly appreciated.
Code: Select all
VaultClientFile file = root.FindFileRecursive( filePath );
file.Version = newVersion;
VaultLabelPromotionItem item = new VaultLabelPromotionItem();
VaultLabelPromotionItem [] items = new VaultLabelPromotionItem [] {item};
item.ChangeType = VaultLabelPromotionChangeType.Delete;
long labelId = GetLabelId( file, label );
if( labelId != -1 )
{
DateTime lastDate = VaultDate.EmptyDate();
int nIdxFailed = 0;
string conflict = null;
Client.PromoteLabelItems( file.FullPath, labelId, label, ref lastDate, items, out nIdxFailed, out conflict );
}
VaultLabelResult result = new VaultLabelResult();
Client.AddLabel( file.FullPath, file.ObjVerID, label, "Adding label", ref result );
Code: Select all
VaultClientFile file = root.FindFileRecursive( filePath );
file.Version = newVersion;
long labelId = GetLabelId( file, label );
if( labelId == -1 )
{
VaultLabelResult result = new VaultLabelResult();
Client.AddLabel( file.FullPath, file.ObjVerID, label, "Adding label", ref result );
return;
}
VaultLabelPromotionItem item = new VaultLabelPromotionItem();
VaultLabelPromotionItem [] items = new VaultLabelPromotionItem [] {item};
item.ChangeType = VaultLabelPromotionChangeType.Modify;
item.ItemName = file.Name;
item.ItemPath = file.FullPath;
item.Version = file.Version;
item.ID = file.ID;
DateTime lastDate = VaultDate.EmptyDate();
int nIdxFailed = 0;
string conflict = null;
Client.PromoteLabelItems( file.FullPath, labelId, label, ref lastDate, items, out nIdxFailed, out conflict );