BuiltInCategory.OST_MatchAll doesn't work when adding new shared parameter

BuiltInCategory.OST_MatchAll doesn't work when adding new shared parameter

demapavlo
Explorer Explorer
190 Views
1 Reply
Message 1 of 2

BuiltInCategory.OST_MatchAll doesn't work when adding new shared parameter

demapavlo
Explorer
Explorer

Hello. I wrote a plug-in thats adds new shared parameter and I want it to be visibile for all categories. I am using 

categorySet.Insert(doc.Settings.Categories.get_Item(BuiltInCategory.OST_MatchAll));

But when launching the plug-in I get following error 

demapavlo_0-1719757767239.png

Any suggestions on how to select all categories? 

0 Likes
Accepted solutions (1)
191 Views
1 Reply
Reply (1)
Message 2 of 2

jeremy_tammik
Alumni
Alumni
Accepted solution

Well, the error message say that one of the categories in the input item is null. Since you are only providing a single input, OST_MatchAll, that does not have a matching category in the Document. Makes sense, doesn't it?

   

However, you need a valid category in the document to call the Insert method. Afact, one way to solve this would be to retrieve all the document categories one by one and add your shared parameter to each of them. I assume this also matches the UI behaviour.

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open