How to build a query that returns a list of workitems by owner name?(or other contributor)
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
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
then set the expresssion to equal the contributor you 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);
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