PedroCunha_67677
PedroCunha_67677

Reputation: 47

Getting All Workitems from Team Area

I have the following objects:

ITeamRepository repo;
IProjectArea projArea;
ITeamArea teamArea;

The process of obtaining the projArea and the teamArea is quite straightforward (despite the quantity of objects involved). However I can't seem to find a way to obtain a list with all the Workitems associated with these objects in a direct way. Is this directly possible, probably via the IQueryClient objects?

Upvotes: 1

Views: 141

Answers (1)

VonC
VonC

Reputation: 1325137

This 2012 thread (so it might have changed since) suggests:

I used the following code to get the work items associated with each project area:

auditableClient = (IAuditableClient) repository.getClientLibrary(IAuditableClient.class);

IQueryClient queryClient = (IQueryClient) repository.getClientLibrary(IQueryClient.class);



IQueryableAttribute attribute = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(currProject, IWorkItem.PROJECT_AREA_PROPERTY, auditableClient, null);

Expression expression = new AttributeExpression(attribute, AttributeOperation.EQUALS, currProject);

IQueryResult<IResolvedResult<IWorkItem>> results = queryClient.getResolvedExpressionResults(currProject, expression, IWorkItem.FULL_PROFILE);

In my code, currProject would be the IProjectArea pointer to the current project as you loop through the List of project areas p in your code.

The IQueryResult object 'results' then contains a list of IResolvedResult records with all of the work items for that project you can iterate through and find properties for each work item.

Upvotes: 1

Related Questions