Saving the attachments to disk programmatically
![]()
Hi All,
Am using RTC 2002; Have a requirement of saving attachments on a workitem to disk programmatically; I did refer couple of postings in this forum and could not get any pointers from them. Am getting a run time cast exception on running the code I have written. The exception looks something like below: Exception in thread "main" java.lang.ClassCastException: com.ibm.team.workitem.common.internal.model.impl.AttachmentHandleImpl incompatible with com.ibm.team.workitem.common.model.IAttachment at com.ibm.team.workitem.ide.ui.example.SaveAttachments.run(SaveAttachments.java:178) at com.ibm.team.workitem.ide.ui.example.SaveAttachments.main(SaveAttachments.java:102) snippet of the code I have written is pated below: IWorkItemReferences fsrcReferences = srcWorkingCopy.getReferences(); Any pointers/ guidance would be of great help. Many thanks in advance. Regards, Mohan. |
2 answers
![]() IAttachment srcAttachment = (IAttachment) attachmentHandle; You cannot cast a handle to an item, you need to resolve it: IAttachment srcAttachment = srcRepository.itemManager().fetchCompleteItem(attachmentHandle, IItemManager.DEFAULT, monitor); -- Regards, Patrick Jazz Work Item Team |
![]()
Thanks a lot Patrick; this resolved my prob.
Thanks & Regards, Mohan. |
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.