We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Extracting Contact Groups from PST

Hi,

How do we extract only contact groups from a PST? Another question: Contacts in a distribution list can be saved to disc?

Thanks

Hi Mark,

Contacts group or Distribution list has message class "IPM.DistList" and can be extract from the contacts folder using this filtering criteria. Please have a look at the following code sample for your reference.

PersonalStorage pst = PersonalStorage.FromFile(strPst);

FolderInfo folderInfo = pst.GetPredefinedFolder(StandardIpmFolder.Contacts);

MessageInfoCollection msgInfoCol = folderInfo.GetContents();

foreach (MessageInfo msgInfo in msgInfoCol)

{

MapiMessage msg = pst.ExtractMessage(msgInfo);

if (msgInfo.MessageClass.Equals("IPM.DistList"))

{

MapiDistributionList dlist = (MapiDistributionList)msg.ToMapiMessageItem();

foreach (MapiDistributionListMember member in dlist.Members)

{

Console.WriteLine(member.DisplayName);

Console.WriteLine(member.EmailAddress);

}

}

}


Hi team,
I am extracting messages from pst. when i got Contact folder , want to save DistributionList messages.
so how do i get message class of distributionList in JAVA.
like that : msgInfo.MessageClass.Equals(“IPM.DistList”;

@pradeepnegi,

Thank you for contacting Aspose Support.

You may check the MessageClass in Java as shown below.

if (msgInfo.getMessageClass().equals("IPM.DistList")) {
    MapiDistributionList dlist = (MapiDistributionList)msg.toMapiMessageItem();
    for (MapiDistributionListMember member : dlist.getMembers()) {
        System.out.println(member.getDisplayName());
        System.out.println(member.getEmailAddress());
    }
}

We hope that this answered your question. Please feel free to reach us if additional information is required.