It's all about the answers!

Ask a question

Creating new WorkItems Server Side


Jason Marston (2111) | asked Apr 28 '09, 2:01 p.m.
Hi,

Can anyone tell me if IWorkItemServer.createWorkItem2 is the only method of creating a new WorkItem on the server.

By that I mean without the eclipse client.

I have worked through some of the examples and have working services etc, but the support for creating WorkItems without resorting to Client interfaces seems limited (unless I am missing something)

Accepted answer


permanent link
Jason Marston (2111) | answered Apr 28 '09, 3:13 p.m.
I guess I am asking.

Is this the right way to go about server side creation of work items?


IProcessServerService processServerService = ...
IWorkItemServer workItemServer = ...

try {
IProjectArea projectArea = (IProjectArea)processServerService.findProcessArea("<MyProjectAreaName>", null);
IWorkItemType workItemType = workItemServer.findCachedWorkItemType(projectArea, "<MyWorkItemType>");
IWorkItem workItem = workItemServer.createWorkItem2(workItemType);

// begin setting up various attributes
...
// end setting up varous attributes

IStatus status = workItemServer.saveWorkItem2(workItem, null, null);
} catch (TeamRepositoryException e) {
e.printStackTrace();
}
Ralph Schoon selected this answer as the correct answer

Your answer


Register or to post 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.