How to get all work items by passing planned for attribute
One answer
Hi,
please find a very good description of this in Ralph Schoon's Blog: Query Models with API
If this answers your question please mark it accepted.
- Arne
Comments
I am also trying to fetch the work items based on the current sprint,
I am also getting java.lang.IllegalArgumentException: Argument must be an instance of IAuditableHandle .
below is my code,
IWorkItemClient workItemClient = (IWorkItemClient) iTeamRepository.getClientLibrary(IWorkItemClient.class);
IAuditableCommon iAuditableCommon = (IAuditableCommon) iTeamRepository.getClientLibrary(IAuditableCommon.class);
IQueryableAttribute planAttribute = factory.findAttribute(projectArea, IWorkItem.TARGET_PROPERTY, iAuditableCommon, monitor);
Expression plan = new AttributeExpression(planAttribute, AttributeOperation.EQUALS, CurrentMilestoneVariable.VARIABLE_ID);
Term term = new Term(Term.Operator.AND);
term.add(plan);
IQueryDescriptor iQueryDescriptor = queryClient.createQuery(projectArea, QueryTypes.WORK_ITEM_QUERY, "AllItems", term);