Jazz Register Log in
Jazz Forum Welcome to the Jazz Community Forum

Welcome to the Jazz Community Forum

Connect and collaborate with IBM Engineering experts and users

Add attachments to work item

Hi,

I'm trying to add attachments to the existing work item. Here is my code:

IWorkItemWorkingCopyManager wcm = workItemClient.getWorkItemWorkingCopyManager();
ItemProfile<IWorkItem> profile = ItemProfile.computeProfile(workitem);
wcm.connect(workItemHandle, profile, monitor);
WorkItemWorkingCopy wc = wcm.getWorkingCopy(workItemHandle);
IWorkItemReferences refs = wc.getReferences();

** It failed when get references with exception
"Feature not contained in access profile WorkItem"

Am I doing it right?

Then I tried to get the references with the following code and it ran through ok:

IWorkItemHandle handle = (IWorkItemHandle)wc.getWorkItem().getItemHandle();
IWorkItemReferences refs = workItemClient.resolveWorkItemReferences(handle, monitor);

After I got the references, I do (file is File object):

IReference ref = IReferenceFactory.INSTANCE.createReferenceFromURI(file.toURI(), file.getAbsolutePath());
if (ref != null) {
refs.add(WorkItemEndPoints.ATTACHMENT, ref);
}
wcm.save(new WorkItemWorkingCopy[]{wc}, monitor);

After save, I try to get the list of references from the work item to see if the work item save correctly. But the list of references is empty.

Any idea? Anything wrong with my code?

Thanks alot for the help, really appreciated.

Thanks!!

0 votes


Be the first one to answer this question!

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,992

Question asked: Feb 20 '09, 8:16 p.m.

Question was seen: 5,915 times

Last updated: Feb 20 '09, 8:16 p.m.

Confirmation Cancel Confirm