It's all about the answers!

Ask a question

How to build a query that returns a list of workitems by owner name?(or other contributor)


Robert Siara (821014) | asked Dec 18 '12, 8:36 p.m.
edited Dec 19 '12, 3:45 a.m.
 Hi ,

How to build a query that returns a list of workitems by owner?(or other contributor)

I use this code in other cases (eg, using the ID in the query):
I do not know how to build a query for example Owner name or other type Contributor

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

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

    IQueryableAttribute attribute = QueryableAttributes.getFactory(
        IWorkItem.ITEM_TYPE).findAttribute(baseProjectArea,
        IWorkItem.ID_PROPERTY, auditableClient, null);

    Expression expression = new AttributeExpression(attribute,
        AttributeOperation.EQUALS, 999); // for example id number: 999


I will be grateful for any help you can provide

4 answers



permanent link
Robert Siara (821014) | answered Dec 19 '12, 9:17 a.m.
 But how get right ContributorHandle , having a user name instead of userID?

 I do not want to download a list of all users, and than choose the right but  get one user(Contributor) using the user name (not userID)

Thank you @sam for your interest

permanent link
Robert Siara (821014) | answered Dec 19 '12, 4:15 a.m.
 I Ask about JAVA plain API

permanent link
Rajat Singh (59833545) | answered Dec 19 '12, 12:50 a.m.
Hi

In RTC web client, click on Workitems->Create Query.
Click on 'Add Condition' and select 'Owned By' condition.
Add the User for which you need to get the list of workitems.
Click Run.

Best Regards
Rajat

permanent link
sam detweiler (12.5k6195201) | answered Dec 19 '12, 7:21 a.m.
edited Dec 19 '12, 8:19 a.m.
You have to do the same as above, but use the IContributorManager class to find the contributor record for the user u seek

then change the code you have to get the attribute handle for the Owner field

    IQueryableAttribute attribute = QueryableAttributes.getFactory(
        IWorkItem.ITEM_TYPE).findAttribute(baseProjectArea,
        IWorkItem.ID_OWNER auditableClient, null);

then set the expresssion to equal the contributor you seek

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

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.