Retrieve history of work item states
I have the following code to begin retrieving the history of a work item using the plain java client.
The issue I'm running into is that the last line of the snippet is throwing a null pointer exception. Not exactly sure why I'm getting that and hoping someone here would have some insight or if there's a better way. Steve |
3 answers
what is 'defectId'?
the findWorkItemById is failing.. Sam |
what is 'defectId'? 'defectId' is an int with a value of 7976, which is a valid work item ID in our database. findWorkItemById is not failing because I can get the various values of the work item that are available with the workItem object, such as description, summary, etc. |
You get a NullPointerException because you cannot get an instance of the WorkItemClient.class with: WorkItemClient
workItemClientInternal = (WorkItemClient) repository.getClientLibrary(WorkItemClient.class); You have to use the constructor method: WorkItemClient workItemClientInternal = new WorkItemClient((IClientLibraryContext) repo); and where repo is your ITeamRepository current instance. Cheers.
|
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.