Skip to content

Instantly share code, notes, and snippets.

@akoidan
Created December 4, 2015 17:09
Show Gist options
  • Save akoidan/229225c908e2e8c13d56 to your computer and use it in GitHub Desktop.
Save akoidan/229225c908e2e8c13d56 to your computer and use it in GitHub Desktop.
Hi, I'm new to Alfresco. I need to get inbound emails from Alfresco. Unfortunately I didn't found a better way than just crawl the emailable directory for files. So to get all users' emails I use:
import org.apache.chemistry.opencmis.client.util.FileUtils;
AfrescoDocumentImpl doc = FileUtils.getObject("emailDir/userEmail/", session);
List<CmisObject> allEmails = doc.getChilder()
Every single object has email properties, for example "cm:sentdate" or "cm:subjectline".
Now I stuck with the issue when an email has attachments and I need to get them as well. I can't find a property in AlfrescoDocumentImpl that matches my needs. I also note that if an email has attachments it would also have "attachable" aspect. I even can fetch all document that have attachments with a query: "SELECT * FROM cm:attachable" but they don't refer to the attached files. The query should be something like "Select* from cm:attachments" but attachments table isn't quaryable.
I found that /share application shows emails attachments. And furthermore a table alf_node_assoc is used to connect them. If I had access to database I would select alf_node with join on alf_node_assoc but I don't have it.
I apologize to post here, I can't create new topic because I'm a new user. Could you please suggest me where to look for functionality I need, or if it's an inappropriate topic to write where I should post my message. Thanks in advance!
I also created a topic on stackoverflow, you can see some images there. Maybe this would give you a clue what I mean.
http://stackoverflow.com/questions/34090937/get-documents-attachments-via-alfresco-opencmis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment