It's all about the answers!

Ask a question

RTC - associate category with Team Area using Plain Java APIs

Radha Nagaraja (1558) | asked Aug 18 '15, 4:50 a.m.
Trying to associate category with team area using Plain JAVA APIs but it fails with the below error.

2 methods used but both fail with different errors.
Code snippet and the error added. Any hints will be of great help :)

1. Call used: ICategoryObject.getTeamAreas().add(ITeamAreaHandle);

Error :

Tried with Category Object too. Same error caused.

2. ICategoryObject.getAsscociatedTeamAreas().add(ITeamAreaHandle);
Error: unmodifiable collection exception for getAsscociatedTeamAreas

K M commented Aug 18 '15, 11:42 a.m.

  ICategory  category = service.createCategory(project,categoryName,MONITOR);
 ITeamArea team         


works for me on a new category, are you trying on an existing category or a new one ?

K M commented Aug 19 '15, 11:08 a.m.

Sorry I was mistaken I had to do this to make it work
ICategory  category = service.createCategory(project,categoryName,MONITOR);
 ITeamArea team

 ((Category) category).getTeamAreas().add(team);
 ((Category) category).setDefaultTeamArea(team);

Radha Nagaraja commented Aug 19 '15, 11:14 a.m.

Thanks K M. We have already tried the 1st option but no success.
 ((Category) category).getTeamAreas().add(team); 
neither for new category created or for an existing category.

Shall try out the 2nd option. Thank you.


One answer

permanent link
Radha Nagaraja (1558) | answered Sep 07 '15, 9:59 a.m.
Thanks KM. Solution worked for creating new categories and associating with team Area.
For existing Categories, working copy has to be created and then the association as you have described works.
Thanks for the solution.


Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.