<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to get Attachment in alfresco? in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-attachment-in-alfresco/m-p/34387#M14522</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to get Attachment in alfresco?&lt;/P&gt;&lt;P&gt;I did something like this.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;public void notify(DelegateTask delegateTask) {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;List &amp;lt;Attachment&amp;gt; at = new ArrayList&amp;lt;Attachment&amp;gt;();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;String processInstanceId = delegateTask.getProcessInstanceId();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;at = delegateTask.getExecution().getEngineServices().getTaskService().getProcessInstanceAttachments(processInstanceId);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However&amp;nbsp;it didn't work&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 May 2017 06:25:14 GMT</pubDate>
    <dc:creator>kangkan</dc:creator>
    <dc:date>2017-05-15T06:25:14Z</dc:date>
    <item>
      <title>How to get Attachment in alfresco?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-attachment-in-alfresco/m-p/34387#M14522</link>
      <description>How to get Attachment in alfresco?I did something like this.public void notify(DelegateTask delegateTask) {List &amp;lt;Attachment&amp;gt; at = new ArrayList&amp;lt;Attachment&amp;gt;();String processInstanceId = delegateTask.getProcessInstanceId();at = delegateTask.getExecution().getEngineServices().getTaskService</description>
      <pubDate>Mon, 15 May 2017 06:25:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-attachment-in-alfresco/m-p/34387#M14522</guid>
      <dc:creator>kangkan</dc:creator>
      <dc:date>2017-05-15T06:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Attachment in alfresco?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-get-attachment-in-alfresco/m-p/34388#M14523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Seems this is a duplicate of :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://stackoverflow.com/questions/43626354/alfresco-activiti-how-get-attachment-id-in-alfresco-activiti" title="http://stackoverflow.com/questions/43626354/alfresco-activiti-how-get-attachment-id-in-alfresco-activiti" rel="nofollow noopener noreferrer"&gt;java - Alfresco Activiti - How get attachment id in alfresco activiti? - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using Activiti Enterprise you will need to use the relatedContentService.&lt;/P&gt;&lt;P&gt;Details of how to use this service can be found in the following forum post:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/thread/226112"&gt;How do you access an uploaded file in a downstream service task?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does appear you participated in this post, as far as I can tell the answer to your question can be found in the code snippet below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff; border: 0px;"&gt; public void execute(DelegateExecution execution) {&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String fileVariableName = "myfile"; // Id of 'upload file field' from form in previous User Task&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Class&amp;lt;?&amp;gt; theClass = Class.forName("com.activiti.conf.ApplicationConfiguration");&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(theClass);&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RelatedContentService relatedContentService = applicationContext.getBean(RelatedContentService.class);&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; List&amp;lt;RelatedContent&amp;gt; contentList = relatedContentService.getFieldContentForProcessInstance(&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; execution.getProcessInstanceId(), fileVariableName, 1, 0).getContent();&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (ClassNotFoundException e) {&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 May 2017 16:26:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-get-attachment-in-alfresco/m-p/34388#M14523</guid>
      <dc:creator>gdharley</dc:creator>
      <dc:date>2017-05-15T16:26:40Z</dc:date>
    </item>
  </channel>
</rss>

