Hello, I am trying to run "viewprojecthistory" using mksapi (java api - mksapi.jar version 4.11.3238) but even if I set required fields it doesnt return the values of these fields.
In the response I see only "revisions" as the field returned. (Please find the comment in the code where it fails)
The code looks as follows.
Command command = new Command(Command.SI, "viewprojecthistory");
SelectionList selectionList = new SelectionList();
OptionList optionList = new OptionList();
optionList.add(new Option("project", mksProjectName));
optionList.add(new Option("yes"));
MultiValue mv = new MultiValue(",");
mv.add("labels");
mv.add("name");
mv.add("memberrev");
mv.add("state");
optionList.add(new Option("fields", "labels,name,memberrev,state"));
command.setOptionList(optionList);
command.setSelectionList(selectionList);
Response resp = api.runCommand (command);
for (WorkItemIterator i = resp.getWorkItems();i.hasNext();) {
WorkItem wi = i.next();
String labels = wi.getField("labels").getValueAsString(); // Fails, there is no field "labels" in workitem
String rev = wi.getField("memberrev").getValueAsString(); // Fails, there is no field "memberrev" in workitem
String state = wi.getField("state").getValueAsString(); // Fails, there is no field "state" in workitem
}
What is going wrong here?
regards,
Ratheesh