It's all about the answers!

Ask a question

How to get Project Area History using java API


Akshay Panchakshari (37113) | asked Oct 03 '16, 4:01 a.m.
I want to read/fetch all the history data for project area (Not work item) .  Is this possible thru JAVA API ?

thanks
Akshay P.

One answer



permanent link
Param S (275) | answered Oct 18 '20, 10:00 a.m.
private static IProjectArea getFirstProjectAreaState(ITeamRepository repo, IProjectArea projectArea) throws TeamRepositoryException{

List history = repo.itemManager().fetchAllStateHandles(projectArea, null);
List<IProjectArea> projectAreas = (List<IProjectArea>)repo.itemManager().fetchCompleteStates(history, null);
Collections.sort(projectAreas, new Comparator<IProjectArea>(){

public int compare(IProjectArea o1, IProjectArea o2) {
int result = 0;
if (o1.modified().getTime() < o2.modified().getTime()) {
result = -1;
} else {
result = 1;
}
return result;
}
});
    IProjectArea firstHistoryEntry = projectAreas.get(0);
    return firstHistoryEntry;
}

Your answer


Register or to post your answer.