It's all about the answers!

Ask a question

CCM Application work item attachments download


Mohib Shaik (11) | asked May 11 '22, 3:58 p.m.

 Hi Team,


I need a help to download all attachments under work item.
For example : In Project Area, I have 3 types of work items and each work item has 5 attachments uploaded by users, I  need to download all attachments.

Thanks,
Mohib  

2 answers



permanent link
Luca Martinucci (1.0k288110) | answered May 18 '22, 9:21 a.m.
edited May 18 '22, 9:21 a.m.

Personally, I am not aware of any "bulk download" feature that allows a user to download all attachments from all work items of Project Area.

Anyway, it should be possible to achieve this goal programmatically.
Some time ago, I developed a server-side extension that was able to download an attachment from a work item during the "save" operation.
Maybe this code snippet can help (supposing you have already retrieved attachment and contentService):

IContentService contentService = ...;
IAttachment attachment = ...;
String attachmentsFolder = "C:\temp\attachments";
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();
}
} catch (FileNotFoundException e) {
// error handling
} catch (IOException e) {
// error handling
}

You could try to do the same with Plain Java API.


permanent link
Ralph Schoon (62.0k33643) | answered May 18 '22, 11:00 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The work item command line supports downloading and storing attachments. See https://github.com/jazz-community/work-item-command-line#available-commands . E.g. exportworkitems can be used to export attachments for multiple items for a query.

Your answer


Register or to post your answer.