Now, I am trying to figure out how to do this label promotion programmatically. Below is the code I'm running, but it's returning error code 1205, which translates to: "The requested operation cannot be performed on this type of object."
Since there isn't any documentatation or samples for PromoteLabelItems, I am having a very difficult time figuring out what to do next. Can someone help. Using Vault 2.0.6.
Code: Select all
Public Function FindReleaseLabelID(Optional ByVal strVaultFile As String = "$/") As Long
Dim nLabelID As Long, rootID As Long
Dim discoveredSubItemPaths As String()
Dim dtLastModified As Date
Dim repositoryDelta As VaultClientNetLib.ClientService.VaultRepositoryDelta
Dim fileDelta As VaultClientNetLib.ClientService.VaultFileDelta
_ci.GetLabelStructureByName("Release", nLabelID, strVaultFile, "", discoveredSubItemPaths, dtLastModified, _
repositoryDelta, fileDelta, rootID)
Return nLabelID
End Function
Public Function AddLatestToRelease(ByVal strVaultFile As String) As Integer
Dim vcfile As VaultClientFile
vcfile = _ci.TreeCache.Repository.Root.FindFileRecursive(strVaultFile)
If vcfile Is Nothing Then
Return -1
Else
Dim dtLastChange As Date
Dim nIdxFailed As Integer
Dim strRootPathConflict As String
Dim vlpi(0) As VaultClientNetLib.ClientService.VaultLabelPromotionItem
vlpi(0) = New VaultClientNetLib.ClientService.VaultLabelPromotionItem
With vlpi(0)
.ChangeType = VaultLib.VaultLabelPromotionChangeType.Modify
.ID = vcfile.ID
.ItemName = vcfile.Name
.ItemPath = vcfile.FullPath
.Version = vcfile.Version
End With
Return _ci.PromoteLabelItems(strVaultFile, FindReleaseLabelID(strVaultFile), "Release", dtLastChange, vlpi, nIdxFailed, strRootPathConflict)
End If
End Function