void SynchObVerId(VaultLabelPromotionItem item) { VaultObjectVersionInfo[] ovis = null; Client.GetObjectVersionList(item.ID, ref ovis, false); item.ObjVerID = -1; foreach (VaultObjectVersionInfo ovi in ovis) { if (ovi.Version == item.Version) { item.ObjVerID = ovi.ObjVerID; return; } } }
public void PromoteLabelVersion(string filePath, string label, long newVersion) { VaultClientFile file = root.FindFileRecursive(filePath); file.Version = newVersion; VaultLabelPromotionItem item = new VaultLabelPromotionItem(); item.ChangeType = VaultLabelPromotionChangeType.Modify; item.ItemName = file.Name; item.ItemPath = file.FullPath; item.Version = file.Version; item.ID = file.ID; long labelId = GetLabelId(root, label); item.Version = newVersion; SynchObVerId(item); long currentLabeledVersion = findVersionWithLabel(file, label); // Move if (currentLabeledVersion != -1) { item.ChangeType = VaultLabelPromotionChangeType.Modify; } else // Add { item.ChangeType = VaultLabelPromotionChangeType.Add; } VaultLabelPromotionItem [] items = new VaultLabelPromotionItem [] { item }; DateTime lastDate = VaultDate.EmptyDate(); int nIdxFailed = 0; string conflict = null; int promoteResult = Client.PromoteLabelItems(root.FullPath, labelId, label, ref lastDate, items, out nIdxFailed, out conflict); string resultString = VaultConnection.GetSoapExceptionMessage(promoteResult); }
public void PromoteLabelVersion( string filePath, string label, long newVersion ) { VaultClientFile file = root.FindFileRecursive( filePath ); file.Version = newVersion; VaultLabelPromotionItem item = new VaultLabelPromotionItem(); item.ChangeType = VaultLabelPromotionChangeType.Modify; item.ItemName = file.Name; item.ItemPath = file.FullPath; item.Version = file.Version; item.ID = file.ID; long labelId = GetLabelId( root, label ); item.Version = newVersion; SynchObVerId( item ); long currentLabeledVersion = findVersionWithLabel( file, label ); // Move if( currentLabeledVersion != -1 ) { item.ChangeType = VaultLabelPromotionChangeType.Modify; } else // Add { item.ChangeType = VaultLabelPromotionChangeType.Add; } VaultLabelPromotionItem [] items = new VaultLabelPromotionItem [] {item}; DateTime lastDate = VaultDate.EmptyDate(); int nIdxFailed = 0; string conflict = null; int promoteResult = Client.PromoteLabelItems( root.FullPath, labelId, label, ref lastDate, items, out nIdxFailed, out conflict ); string resultString = VaultConnection.GetSoapExceptionMessage( promoteResult ); }
void SynchObVerId( VaultLabelPromotionItem item ) { VaultObjectVersionInfo[] ovis = null; Client.GetObjectVersionList( item.ID, ref ovis, false); item.ObjVerID = -1; foreach( VaultObjectVersionInfo ovi in ovis ) { if( ovi.Version == item.Version ) { item.ObjVerID = ovi.ObjVerID; return; } } }