Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Email Receiver QPAC: how to get filenames of attachments stored in list variable?

Avatar

Former Community Member
Hi,



in the SDK 7.05 there's the following passage in the readme:





The updated Email Receiver QPAC allows you to extract email attachments and store them in a Workflow List variable. They will be stored as a List of Documents, which makes it easy to attach these documents to a task using the updated User QPAC.




But after I stored all attachments in a list of type Document, how do I get the attachments' orginal filenames? I wonder, if it's as simple as
myDoc.getAttribute("filename") would be?



Does anyone know, how to get the filename from com.adobe.idp.Document objects the Email Receiver QPAC instantiates?



Regards,

Steve
6 Replies

Avatar

Level 9
Hi Steve

You should be able to index into the particular document within the list using syntax something like:

/process_data/mylist[1]

(Remember that xpath is 1-based, not zero-based)

Once you have a particular document, there is an xpath function to get the filename of the document (can't remember the syntax, and don't have a running Workflow to test on, but it should show up in the XPath browser.)



I hope this helps...

Howard

http://www.avoka.com

Avatar

Former Community Member
Hi Howard,



I'm sorry, I did not find the method to get the filename of a Document object.



The XPath expression builder features the following Document methods:








  • getDocLength(com.adobe.idp.Document)



    which works fine and returns the object's size in bytes.



  • getDocAttribute(com.adobe.idp.Document, String)



    which does not work because the Documents instantiated by email receiver do not seem to feature any attributes (invoking
    listAttributes() on the Document objects in the list, returns a Set of length 0).



  • setDocAttribute(com.adobe.idp.Document, String, String)




  • getDocContentType(com.adobe.idp.Document)



    which _always_ returns
    null, even for very common files like PDF (I guess the email receiver does not call
    setContentType(String) on Document objects it instantiates).



  • setDocContentType(com.adobe.idp.Document, String)







Also, invoking the document's
getFile().getName() is pretty useless, as it returns some random number like '3388160831619972562'.



What did I miss?



Regards,

Steve

Avatar

Level 9
Hi Steve

You're entirely correct, my apologies for relying on my (somewhat shaky) memory, rather than looking it up.

Please see my other post in response to this question.

We could look at doing something to help you with this.



Regards,

Howard

http://www.avoka.com

Avatar

Former Community Member
You need to pass the property "wsfilename" to the getDocAttribute

Avatar

Former Community Member
You need to use "wsfilename" attribute to get the filename.So Pass the "wsfilename" to the getDocAttribute method

Avatar

Level 9
Hi

The EmailReceiver doesn't set wsfilename, so you can't get it using getDocAttribute.

If either of you would like to discuss further, please email info-at-avoka.com.

Howard