Welcome to the Jazz Community Forum
Can we download the files attached to workitems in RTC?

2 answers

You can create yourself a tool: https://rsjazz.wordpress.com/2012/09/21/downloading-attachments-from-work-items/

I have done that in a plugin (follow-up action), using server-side Java API.
This works for only one work item, but you can use thes snippets as a starting point, by adapting them to plain Java API.
public IAttachment getAttachment (IWorkItem workItem)
throws TeamRepositoryException {
IAttachment attachment = null;
IWorkItemReferences workItemReferences = saveParameter.getNewReferences();
List<IReference> attachmentReferencesList = workItemReferences.getReferences(WorkItemEndPoints.ATTACHMENT);
for (IReference attachmentReference : attachmentReferencesList) {
if (attachmentReference.isItemReference()) {
IItemHandle referencedItem = ((IItemReference) attachmentReference).getReferencedItem();
String itemKind = referencedItem.getItemType().getName();
if (referencedItem instanceof IAttachmentHandle) {
attachment = (IAttachment) repositoryItemService.fetchItem(referencedItem, IRepositoryItemService.COMPLETE);
break;
}
}
}
return attachment;
}
public boolean saveAttachment(IAttachment attachment)
throws TeamRepositoryException {
boolean saved = false;
try {
String attachmentName = attachment.getName();
String attachmentPath = attachmentsFolder + "\" + attachmentName;
File save = new File(attachmentPath);
OutputStream out = new FileOutputStream(save);
try {
contentService.retrieveContent(attachment.getContent(), out);
} finally {
out.close();
}
saved = true;
} catch (FileNotFoundException e) {
saved = false;
} catch (IOException e) {
saved = false;
}
return saved;
}