How to get workItemId by summary?
Hi
I want to search a work Item by summary?
I don't want to pull all the work Item and do search in the summary?
Is there any way i can get the list of work item ID whose summary matches to a text without pulling all the work Items .
I mean without using this code:-
IQueryResult<IResolvedResult<IWorkItem>> results =
queryClient.getResolvedExpressionResults(projectArea, expression,IWorkItem.FULL_PROFILE);
while(results.hasNext(progressMonitor)){
workItem1= results.next(progressMonitor).getItem();
String summary=workItem1.getHTMLSummary();
}
Above displayed code pulls all the work Item which I don't prefer because it is slow and I don't want to pull all the work items cause it might make java run out of memory.
Any kind of suggestion will be appreciated.
Thanks
I want to search a work Item by summary?
I don't want to pull all the work Item and do search in the summary?
Is there any way i can get the list of work item ID whose summary matches to a text without pulling all the work Items .
I mean without using this code:-
IQueryResult<IResolvedResult<IWorkItem>> results =
queryClient.getResolvedExpressionResults(projectArea, expression,IWorkItem.FULL_PROFILE);
while(results.hasNext(progressMonitor)){
workItem1= results.next(progressMonitor).getItem();
String summary=workItem1.getHTMLSummary();
}
Above displayed code pulls all the work Item which I don't prefer because it is slow and I don't want to pull all the work items cause it might make java run out of memory.
Any kind of suggestion will be appreciated.
Thanks
Accepted answer
you would have to use a different expression operation..
use the summary field, operation contains, and text data
use the summary field, operation contains, and text data
One other answer
Thanks Sam
You are a live saver It did work with the concept you gave
For other who might need this code:
Expression ismyType = new AttributeExpression(type1,AttributeOperation.CONTAINS, summary);
IQueryResult<IResolvedResult<IWorkItem>> resultsResolvedss= queryClient.getResolvedExpressionResults(projectArea, ismyType, IWorkItem.FULL_PROFILE);
workItem1=null;
System.out.println("trail"+resultsResolvedss.getTotalSize(progressMonitor));
while(resultsResolvedss.hasNext(progressMonitor)){
workItem1= resultsResolvedss.next(progressMonitor).getItem();
int workItemID=workItem1.getId();
System.out.println("^*^ "+workItemID+" "+workItem1.getHTMLSummary().getPlainText());
}
You are a live saver It did work with the concept you gave
For other who might need this code:
Expression ismyType = new AttributeExpression(type1,AttributeOperation.CONTAINS, summary);
IQueryResult<IResolvedResult<IWorkItem>> resultsResolvedss= queryClient.getResolvedExpressionResults(projectArea, ismyType, IWorkItem.FULL_PROFILE);
workItem1=null;
System.out.println("trail"+resultsResolvedss.getTotalSize(progressMonitor));
while(resultsResolvedss.hasNext(progressMonitor)){
workItem1= resultsResolvedss.next(progressMonitor).getItem();
int workItemID=workItem1.getId();
System.out.println("^*^ "+workItemID+" "+workItem1.getHTMLSummary().getPlainText());
}