I am trying to programmatically assign a change to the CATEGORY of a set of old FILEs so they match recent RULE changes. (vb.net \ vault 2014 pro)
I want to produce the same results as the attached dialogue box entry achieves in the vault client.
Are you aware of a quick way to achieve this? or do I need to roll my sleeves up a write a SUB to work through each RULE set in order, checking the conditions listed and changing the category on the results?
FYI: My final goal is to add this as a POST event to vault check-in (Web Service Command Events), thus ensuring the FILE category always match the current rule set.
I welcome your advice and suggestions for shortcuts.
Joe
Solved! Go to Solution.
Solved by Redmond.D. Go to Solution.
Have you tried the function CategoryService.ApplyCategoryRules( )? I believe this returns the category that a file should go in based on the current rule set.
Thank you doug, just the pointer I needed. Saved me half a days work I recon. My first attempt at code below shown, (assumes Connect2Vault is a valid VDF connection)
Public Function CatNameFromRules(VaultFile As File) As String
'MsgBox("File Lists as in CATEGORY = " & VaultFile.Cat.CatName)
Dim CATIDs As Long() = Connect2Vault.WebServiceManager.CategoryService.ApplyCategoryRules(New Long() {VaultFile.MasterId})
Dim FoundCategory As Cat = Connect2Vault.WebServiceManager.CategoryService.GetCategoryById(CATIDs(0))
'MsgBox("Rules say it should be " & FoundCategory.Name)
Return FoundCategory.Name
End Function
All the best
Joe