Get List AssignedTo and Priority
Hello how can I get a list of all valid "assigned To" users, and a list with all priories?
I can't find it in the WorkItemStore?
WorkItemStore
store = (WorkItemStore)tfs.GetService(typeof
(WorkItemStore));Thanks!
regards
Simon
One way would be to get all the allowed values of "AssignedTo" field.
WorkItemStore store = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
Project proj = store.Projects["<Project_Name>"];
WorkItem wi =newWorkItem(proj.WorkItemTypes["<WorkItem_Type>"]);
string[] users =newstring[wi.Fields["System.AssignedTo"].AllowedValues.Count];
int i = 0;
foreach (string userin tsk.Fields["System.AssignedTo"].AllowedValues)
{
users[i++] = user;
}
Sane way you can get other fields values.
Regards,
Hi Simon,
The list of allowed values for a certain field is specific to the state of a certain work item. Therefore, the WorkItemStore cannot expose such a list since all values are not valid at all times and for all work item types.
Smitha's code shows you the way to get the list of allowed values for a field - per workitem.
Thanks,
Karthik