Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Email Receiver: how to get the names of stored attachments?

Avatar

Former Community Member
Hi,



I hate to spam this forum. But I'm in desperate need of the names of attachments, the email receiver QPAC receives.

If I select a list variable for the email receiver to store all attachments received into, all filenames appear to be lost. Also the MIME-types appear to be lost. Which is not big a problem, since I may use javax.activation in order to identify the MIME-type of any fileinputstream. But sometimes, I am unable to correctly identify the MIME-type. Then I need to fall back on the file's original name.



So the simple question is: how do I get the 'filename' attribute of org.idp.Document objects instantiated by email receiver QPAC?

Did anyone ever do that?



Regards,

Steve
5 Replies

Avatar

Former Community Member
Hi Steve

I haven't tried this specifically with the email receiver qpac, but there are now Xpath functions available for Document Objects. See the post at http://www.adobeforums.com/cgi-bin/webx/.3bc34883/3 to see if these examples are any help to you.

Diana

Avatar

Former Community Member
Hi Diana,



1) I used the XPath expression indicated in the screenshot below. It resulted in the process variable
filename being
NULL.








2) I using the following Java-Code in a scripting QPAC:






import java.util.ArrayList;

import java.util.Iterator;

import java.util.Set;



ArrayList list = patExecContext.getProcessDataListValue("/process_data/attachments");

System.out.println("[TEST] num attachments: "+ list.size());



for (Iterator it = list.iterator(); it.hasNext(); ){

com.adobe.idp.Document doc = (com.adobe.idp.Document)it.next();

System.out.println("[TEST] attachment #1, filename: '"+ doc.getFile().getName() +"'");

System.out.println("[TEST] attachment #1, filename-attribute: '"+ doc.getAttribute("wsfilename") +"'");

System.out.println("[TEST] attachment #1, file size: '"+ doc.length() +"'");

System.out.println("[TEST] attachment #1, content-type: "+ doc.getContentType());



Set attributeList = doc.listAttributes();

System.out.println("[TEST] num attributes: "+ attributeList.size());



for (Iterator attributeIter = attributeList.iterator(); attributeIter.hasNext();){

String attribute = (String)attributeIter.next();

System.out.println("[TEST] attribute found: "+ attribute);

}

}






Its output in the logfile was the following:






[STDOUT] [TEST] num attachments: 1

[STDOUT] [TEST] attachment #1, filename: '646834941068179579'

[STDOUT] [TEST] attachment #1, filename-attribute: 'null'

[STDOUT] [TEST] attachment #1, file size: '14624'

[STDOUT] [TEST] attachment #1, content-type: null

[STDOUT] [TEST] num attributes: 0






Is there something I did wrong?

Or is it even possible that the Email Receiver does not care about attributes of attachments?



Regards,

Steve

Avatar

Former Community Member
Hi Steve

I think you may be correct that the Email Receiver QPAC is not set up to collect the attributes of attachments.



The User QPAC is specifically designed to do this. If you create a simple workflow with a User QPAC and a setValue qpac

you will see a value for "wsfilename" for attachments that are added via the attachment window in Form Manager.



1) In the user QPAC, select "Copy all attachments from the previous task". Also check "Map out Attachments into a List of Document Variables:" and choose your list of type document.

2) In a setValue QPAC, do a getDocAttribute at position [1] for wsfilename and capture the name of that in a string variable.

3) In Form Manager, intiate your workflow and add an attachment in the attachment window.

4) Log in as the recipient and submit again.

5) Check your database and you should see the name of your attachment in the string variable.



Since the X-path works correctly in this case, I believe an enhancement might be required for the Email Receiver QPAC.



Diana

Avatar

Level 9
Hi Steve

I had a look, and agree with Diana's assessment - the EmailReceiver does not set any attributes, or the mime type.

doc.getFile().getName() will also not work, because it gives you the name of the "stored" file that workflow will keep this variable in, rather than the original name of the file.



If you absolutely need the filename/mimetype, you have a couple of options:

- put in a feature request via Adobe support, and wait for an updated release

- register this as a feature request for LiveCycle ES

- write your own version of EmailReceiver that adds the functionality you require

- get a third-party to write a version of EmailReceiver that adds this functionality. We would be happy to quote on this if you're interested. Please email sales-at-avoka.com



Sorry the news isn't a little better...



Regards,

Howard

http:/www.avoka.com

Avatar

Level 9
Hi Steve

Please drop me a line at htreisman-at-avoka.com - I've had some discussions internally, and we may be able to do something for you...



Howard