I have EML and MSG files that contain attachments. I want to combine the original EML/MSG document with each of its attachments into a single PDF. How can I do this?
To do this you are going to need to create a viewing session for the EML or MSG file. Once you've created the viewing session you can get the viewingSessionIds
of the attachments. Once you have the viewingSessionIds
you can get the workFile
ID associated with each viewing session. With the workfile
IDs you can use the Content Conversion Service (CCS) to combine the email with its attachments into a single PDF.
Use the following API requests to do this:
Create a new viewing session with:
POST {server_base_url}/PCCIS/V1/ViewingSession
This will give you a viewingSessionId
which will be used in future requests.
The body for this request will be JSON:
{
"render": {
"html5": {
"alwaysUseRaster": false
}
}
}
Upload the document with:
PUT {server_base_url}/PCCIS/V1/ViewingSession/u{viewingSessionId}/SourceFile?FileExtension={extension}
The request body must be bytes of the source document. Make sure to include the FileExtension
or PrizmDoc won't be able to detect the file as an EML or MSG file.
Poll for and get the viewingSessionIds
of the attachments with:
GET {server_base_url}/PCCIS/V1/ViewingSession/u{viewingSessionId}/Attachments
This will return the viewingSessionIds
for each of the attachments.
Get the workfile
ID for each of the viewing sessions with:
GET {server_base_url}/PCCIS/V1/ViewingSession/u{viewingSessionId}/FileId
You'll need to get a fileId
for each attachment's viewingSession
and the email's viewingSession
.
With those workfile
IDs, you can use the Content Conversion Service (CCS) to combine each of the workfiles
with:
POST {server_base_url}v2/contentConverters
The body for this request will be JSON and need to include the workfileId
for each of the attachments and the email itself. The body would look like this:
{
"input": {
"sources": [
{
"fileId": "{EmailWorkFileId}"
},
{
"fileId": "{Attachment1WorkFileId}"
},
{
"fileId": "{Attachment2WorkFileId}"
}
],
"dest": {
"format": "pdf"
}
}
}
This will return a processId
that you can poll using:
GET /v2/contentConverters/{processId}
Once the process is complete, the request will return a results
array that will contain the fileId
of the final document.
You can get the final document that contains all the attachments and original EML/MSG file combined into a single PDF with:
GET /PCCIS/V1/WorkFile/{fileId}
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article