how to use java api (RTC ClientLib4.0) to download attachment?
I have already wrote this code:
List<IReference> wang=refs.getReferences(WorkItemEndPoints.ATTACHMENT); System.out.println("Jerry now!"); for(IReference ref:wang){ IAttachmentHandle ath=(IAttachmentHandle)ref.resolve(); IAttachment attachment=clientA1.resolveAuditable(ath,IAttachment.FULL_PROFILE,monitor); System.out.println(attachment.getName()); IContent content=attachment.getContent(); System.out.println(content); but now I want to down load the attachment file to my server on which this code will be run, but I only got an object of IAttachment and then IContent, I really do not know how to write such codes, could you help me? Thanks! } |
Accepted answer
Ralph Schoon (63.5k●3●36●46)
| answered Jan 07 '13, 12:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please see http://rsjazz.wordpress.com/2012/09/21/downloading-attachments-from-work-items/ for an example.
yu xin liang selected this answer as the correct answer
Comments
yu xin liang
commented Jan 07 '13, 1:20 a.m.
Hi schoon, thanks for your rapid response, but I cannot open that link, is that right? thanks a lot!
Hi Yu, apparently wordpress is blocked in china. This is what we found as a workaround:
Hi Yu, please let me know if the work around is working for you. Thanks!
|
One other answer
Ralph Schoon (63.5k●3●36●46)
| answered Jan 07 '13, 2:53 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Our lawyers reminded me to state that the code in this post is derived from examples from Jazz.net as well as the RTC SDK. The usage of code from that example source code is governed by this license. Therefore this code is governed by this license, which basically means you can use it for internal usage, but not sell. Remember that this code comes with the usual lack of promise or guarantee. Enjoy!
The example below is based on the wiki entry on Programmatic Work Item Creation. I basically use the
The code below shows how to get to the attachments resolving the work item references and using the endpoint to narrow down to the attachments. See the post about manipulation references using the Plain Java Client Library for more details on references.
Once the
The
As usual the exception handling is very basic and you might want to improve that if using this code. I hope this is helpful and saves some cycles searching through the RTC SDK. |
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.