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: 

Assign Property to a Category

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
orbjeff
595 Views, 2 Replies

Assign Property to a Category

Using the Vault 2012 API, I am able to create a new category and property definition. I'd like to then assign this new property definition to my new category.

 

Maybe another way to say this is that I want to make my new property a behavior of my new category. I've searched the API document and this forum but I can't figure out how to do that.

 

1.) Is this possible through the API?

2.) If yes which service and method would I use?

 

Thank you,

 

Jeff

Jeff Johnson
Technical Consultant
MasterGraphics Inc.
2 REPLIES 2
Message 2 of 3
Redmond.D
in reply to: orbjeff

Yes, you can assign property definitions to a category through the API.  It's not a very intuitive set of functions.

 

 

Background:

A category is a collection of behaviors. A behavior is just a piece of functionality. Currently a category can have 3 types of behaviors: lifecycle definitions, revision schemes, and property definitions. In your case, it's the property definition behavior that you want to edit.

 

Solution:

The function you need to call is UpdateCategoryBehaviorAssignmentTypes in the CategoryService.

Here is what you do for each parameter:

categoryId - The ID of the category you are editing

behaviorClassName - pass in "UserDefinedProperty"

allowNoBehavior - I don't think this parameter applies to the property behavior. Vault Explorer passes in YES so you should do that too.

behaviorIds - pass in an array of all property definition IDs you want associated with this category. Since you are adding a prop def you need to pass in an array of all existing prop definitions with the new prop definition added.  (see next section)

behaviorAssignTypes - Again, I don't think this applies to categories. Just pass in an array of DEFAULT since that is what Vault Explorer does.

disableAllThenApply - Pass in TRUE here.

 

Finding the existing property definitions on a category:

GetCategoryConfigurationById should give you what you want. Pass in the category ID and tell it you want the UserDefinedProperty behavior.

It will give you back a CatCfg object which has the information you need. The BhvCfgArray[0].BhvArray property will be an array of all the existing property definition IDs for that category.



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 3 of 3
orbjeff
in reply to: Redmond.D

Doug,

 

Thanks for your help and the additional write up (with code) on your blog page. For anyone else interested its located here:

 

http://justonesandzeros.typepad.com/blog/2012/03/setting-the-properties-on-a-category.html

 

 

Jeff Johnson

 

Jeff Johnson
Technical Consultant
MasterGraphics Inc.

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

Post to forums  

Autodesk Design & Make Report