It's all about the answers!

Ask a question

How to get workitems list of specific type


Robert Siara (821014) | asked Nov 13 '12, 12:53 p.m.
Hi,

I know how to get a list of all workitems from repository, but is there a way to download workitems by type?

Thanks for any help.

4 answers



permanent link
sam detweiler (12.5k6195201) | answered Nov 23 '12, 8:00 p.m.
edited Nov 23 '12, 8:06 p.m.
you will need to create a workitem query object, and execute that to get the list..

see this topic getting-work-items-through-plain-java-api


permanent link
Brian Fleming (1.6k11928) | answered Nov 13 '12, 5:19 p.m.
If I understand what you're trying to do, you would need to create a work item query where one of the conditions is Type.  You could then run the query via the web ui and click the "Download as Spreadsheet" icon, or in the Eclipse UI, go to File->Export, expand Team, select Work Items, then select your query.

permanent link
Robert Siara (821014) | answered Nov 23 '12, 6:18 p.m.
I ask how get list of work items of specific type programmatically.

permanent link
Robert Siara (821014) | answered Dec 18 '12, 12:27 p.m.
 public void getWorkItemsByType(String type) throws TeamRepositoryException { 

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

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

    IQueryableAttribute attribute = QueryableAttributes.getFactory(
        IWorkItem.ITEM_TYPE).findAttribute(getProjectArea(),
        IWorkItem.TYPE_PROPERTY, auditableClient, null);

    IWorkItemClient workItemClient = (IWorkItemClient) getRepository()
        .getClientLibrary(IWorkItemClient.class);

    List<IWorkItemType> types = workItemClient.findWorkItemTypes(
        getProjectArea(), null);

    String ppp = types.get(0).getIdentifier();
    Expression expression = new AttributeExpression(attribute,
        AttributeOperation.EQUALS, type);

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

  }

It may be useful for someone

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.