Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How can I read an attachment with the serverside api

Hi all,
for customization project I want to download a workitem attachment to a directory on the server.

Reading Ralphs blog post I know how to download and read an attachment for the client side:
http://rsjazz.wordpress.com/2012/09/21/downloading-attachments-from-work-items/

But I want to try to do it as a serverside plugin where contentManager is not available. I found the following article describing the server side version to read files:
https://jazz.net/forum/questions/102417/abstractscmadvisor-how-do-you-read-changed-file-content

However, IServerSideVersionedContentService needs input of type IVersionable.

How can I download/read IAttachment using the server API?

Thank you!

0 votes


Accepted answer

Permanent link
you can use the IAuditableCommon service

fAuditableCommon = getService(IAuditableCommon.class);

OutputStream os = new ByteArrayOutputStream();

fAuditableCommon.retrieveContent(iattachment.getContent(), os, monitor)

that gives you the binary data of the attachment
Kevin Eifinger selected this answer as the correct answer

0 votes

Comments

Thank you!! 

note that you may need to add the IAuditableCommon class to your plugin dependencies list in plugin.xml


Your answer

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,951
× 7,507

Question asked: Nov 06 '14, 9:09 a.m.

Question was seen: 4,166 times

Last updated: Nov 06 '14, 9:33 a.m.

Confirmation Cancel Confirm