How to set values in Workitem List attribute using server API
Accepted answer
I've recently done that (in CLM 6.0.3), it is straightforward.
Basically, these are the steps:
- get the current value of the WI List attribute, as a List object;
- get the work item you want to add, as a IWorkItem object;
- add the work item to the List, using the add method;
- set the List as the new value of the attribute, using the setValue method (see the examples provided by Ralph):
- save the work item that contains the attribute you've updated (using the saveWorkItem3 method in the examples).
Just retrieve the work item you want to add to the list.
One other answer
The server API works exactly like the client API in most of the areas. Here how to save in the server API: https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/
A list attribute is a List and the interface provides an add to add the data that is missing.So you make sure the list contains that it is supposed and then save, I think. See https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/