use of com.pff.PSTRecipient in project Xponents by OpenSextant.
the class OutlookPSTCrawler method getRecipients.
/**
*
* @param appt PST API object
* @return list of recipients
* @throws PSTException err
* @throws IOException err
*/
public List<String> getRecipients(PSTAppointment appt) throws PSTException, IOException {
int recipients = appt.getNumberOfRecipients();
if (recipients > 0) {
List<String> rList = new ArrayList<String>();
for (int r = 0; r < recipients; ++r) {
PSTRecipient R = appt.getRecipient(r);
rList.add(String.format("%s <%s>", R.getDisplayName(), R.getEmailAddress()));
}
return rList;
}
return null;
}
use of com.pff.PSTRecipient in project tika by apache.
the class OutlookPSTParser method parserMailItem.
private void parserMailItem(XHTMLContentHandler handler, PSTMessage pstMail, EmbeddedDocumentExtractor embeddedExtractor) throws SAXException, IOException {
Metadata mailMetadata = new Metadata();
mailMetadata.set(Metadata.RESOURCE_NAME_KEY, pstMail.getInternetMessageId());
mailMetadata.set(Metadata.EMBEDDED_RELATIONSHIP_ID, pstMail.getInternetMessageId());
mailMetadata.set(TikaCoreProperties.IDENTIFIER, pstMail.getInternetMessageId());
mailMetadata.set(TikaCoreProperties.TITLE, pstMail.getSubject());
mailMetadata.set(Metadata.MESSAGE_FROM, pstMail.getSenderName());
mailMetadata.set(TikaCoreProperties.CREATOR, pstMail.getSenderName());
mailMetadata.set(TikaCoreProperties.CREATED, pstMail.getCreationTime());
mailMetadata.set(TikaCoreProperties.MODIFIED, pstMail.getLastModificationTime());
mailMetadata.set(TikaCoreProperties.COMMENTS, pstMail.getComment());
mailMetadata.set("descriptorNodeId", valueOf(pstMail.getDescriptorNodeId()));
mailMetadata.set("senderEmailAddress", pstMail.getSenderEmailAddress());
mailMetadata.set("recipients", pstMail.getRecipientsString());
mailMetadata.set("displayTo", pstMail.getDisplayTo());
mailMetadata.set("displayCC", pstMail.getDisplayCC());
mailMetadata.set("displayBCC", pstMail.getDisplayBCC());
mailMetadata.set("importance", valueOf(pstMail.getImportance()));
mailMetadata.set("priority", valueOf(pstMail.getPriority()));
mailMetadata.set("flagged", valueOf(pstMail.isFlagged()));
mailMetadata.set(Office.MAPI_MESSAGE_CLASS, OutlookExtractor.getMessageClass(pstMail.getMessageClass()));
mailMetadata.set(Message.MESSAGE_FROM_EMAIL, pstMail.getSenderEmailAddress());
mailMetadata.set(Office.MAPI_FROM_REPRESENTING_EMAIL, pstMail.getSentRepresentingEmailAddress());
mailMetadata.set(Message.MESSAGE_FROM_NAME, pstMail.getSenderName());
mailMetadata.set(Office.MAPI_FROM_REPRESENTING_NAME, pstMail.getSentRepresentingName());
//add recipient details
try {
for (int i = 0; i < pstMail.getNumberOfRecipients(); i++) {
PSTRecipient recipient = pstMail.getRecipient(i);
switch(OutlookExtractor.RECIPIENT_TYPE.getTypeFromVal(recipient.getRecipientType())) {
case TO:
OutlookExtractor.addEvenIfNull(Message.MESSAGE_TO_DISPLAY_NAME, recipient.getDisplayName(), mailMetadata);
OutlookExtractor.addEvenIfNull(Message.MESSAGE_TO_EMAIL, recipient.getEmailAddress(), mailMetadata);
break;
case CC:
OutlookExtractor.addEvenIfNull(Message.MESSAGE_CC_DISPLAY_NAME, recipient.getDisplayName(), mailMetadata);
OutlookExtractor.addEvenIfNull(Message.MESSAGE_CC_EMAIL, recipient.getEmailAddress(), mailMetadata);
break;
case BCC:
OutlookExtractor.addEvenIfNull(Message.MESSAGE_BCC_DISPLAY_NAME, recipient.getDisplayName(), mailMetadata);
OutlookExtractor.addEvenIfNull(Message.MESSAGE_BCC_EMAIL, recipient.getEmailAddress(), mailMetadata);
break;
default:
//do we want to handle unspecified or unknown?
break;
}
}
} catch (PSTException e) {
//swallow
}
byte[] mailContent = pstMail.getBody().getBytes(UTF_8);
embeddedExtractor.parseEmbedded(new ByteArrayInputStream(mailContent), handler, mailMetadata, true);
}
Aggregations