Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

<APPLY ASSIGNMENT RULES> to change CATEGORY of FILE already in vault

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
joe
Contributor
515 Views, 2 Replies

<APPLY ASSIGNMENT RULES> to change CATEGORY of FILE already in vault

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

2 REPLIES 2
Message 2 of 3
Redmond.D
in reply to: joe

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.



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 3 of 3
joe
Contributor
in reply to: Redmond.D

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report