My application needs to know when contacts, appointments, and tasks in the PST were created and modified. This does not seem to be in the property list of the items and I can’t find an appropriate method to access the information.
I believe the information is stored in the PST. I was able to retrieve it using the open source “java-pstlib” code.
Can I access the information using Aspose.eMail?
Hi Steven,
Thank you for using Aspose.Email.
To retrieve your required information, you can use the PR_CREATION_TIME and PR_LAST_MODIFICATION_TIME MapiProperties. Please have a look at the following code for your kind reference and let us know your feedback.
public static void main(String[] args) {
// load the Outlook PST file
PersonalStorage pst = PersonalStorage.fromFile("K:\\Outlook.pst");
ExtractProperties(pst, "Calendar");
ExtractProperties(pst, "Tasks");
ExtractProperties(pst,"Contacts");
System.out.println("Execution Done..");
}
public static void ExtractProperties(PersonalStorage pst, String strFolder) {
System.out.println("Displaying " + strFolder + " Info:");
// Get the Contacts folder
FolderInfo folderInfo = pst.getRootFolder().getSubFolder(strFolder);
// Loop through all the contacts in this folder
MessageInfoCollection messageInfoCollection = folderInfo.getContents();
int iItemCount = 1;
for (int i=0; i<messageInfoCollection.size();i++) {
MessageInfo messageInfo = (MessageInfo)messageInfoCollection.get(i);
MapiMessage Item = pst.extractMessage(messageInfo);
System.out.println("\nItem # " + iItemCount);
System.out.println("Subject" + Item.getSubject());
System.out.println("Body" + Item.getBody());
MapiProperty propCreationTime = Item.getProperties().get(MapiPropertyTag.PR_CREATION_TIME);
System.out.println("Creation Time: " + propCreationTime.toString());
MapiProperty propModificationTime = Item.getProperties().get(MapiPropertyTag.PR_LAST_MODIFICATION_TIME);
System.out.println("Modification Time" +propModificationTime.toString());
iItemCount++;
}
System.out.println("------------------------------------------------------");
}
Thanks for prompt response. This is just the info I needed.
Hi Steven,
You are welcome and please feel free to contact us if you have any additional query. We will be glad to help you as soon as possible.