Extract Attachments from PST Messages using Aspose.Email for .NET 6.1.0

Share on FacebookTweet about this on TwitterShare on LinkedIn

We are pleased to announce the release of Aspose.Email for .NET 6.1.0. This month’s release includes a number of enhancements to various functional areas of the API. These are specifically related to the API’s Exchange Server client and Personal Storage (PST) functionality. It also includes a number of bug fixes that further add to the stability of the API. To get further details about what is new and fixed, please visit our product download page. You may also be interested in visiting our product documentation section to get an idea about the overall API changes in this month’s release.

New Features & Enhancements

Extracting Attachments from Messages within PST: Working with PST files is one of the key features of Aspose.Email API. It not only provides the capability to generate PST files, but also manipulate these for extraction of messages, appointments, calendar and other Outlook message types. This month’s release further enhances the capabilities of working with PST files by providing the feature of extracting message attachments without extracting the complete message first. Thus, attachments can be extracted directly from the email message using the Message summary information (MessageInfo) or unique string id of the message as shown in the following code sample.

using (var pst = PersonalStorage.FromFile(testFile.Name))
{
    FolderInfo folder = pst.RootFolder.GetSubFolder("Inbox");

    foreach (var messageInfo in folder.EnumerateMessagesEntryId())
    {
        MapiAttachmentCollection attachments = pst.ExtractAttachments(messageInfo);

        if (attachments.Count != 0)
        {
            foreach (var attachment in attachments)
            {
                if (!string.IsNullOrEmpty(attachment.LongFileName))
                {
                    attachment.Save(attachment.LongFileName);
                }
            }
        }
    }
}

Getting Parent Folder Information of a Message in PST: This month’s release also includes an enhancement of accessing a message’s parent folder information in a PST. This can be achieved using the GetParentFolderInfo of the PersonalStorage class. The API uses the message’s summary information object, MessageInfo, or the stringId of the message for retrieving the message’s parent folder information.

Setting MapiCalendar Timezone Information: Aspose.Email API now provides the capability to initialize a calendar’s time zone information from standard Time zone object provided by the .NET framework. The overloaded member of MapiCalendarTimezone can be used to initialize a calendar’s timezone to local time zone object. Please note that this feature is available in .NET 3.5 and above.

Provision of Including Special Characters in Folder Names: Aspose.Email’s Exchange Web Service (EWS) API already provides the capability of creating folders and sub-folders in an Exchange Mailbox. However, the API had an issue while creating a folder name with “/” in it. It resulted in creating sub-folder after the “/”. This month’s release now provides IEWSClient.UseSlashAsFolderSeparate property to treat slash as folder separator and create sub-folder in mailbox.

Other Improvements

This month’s release also includes a number of bug fixes that were faced by our valued customers while working with the previous version. Our product download page contains information about all the bug fixes and can be consulted for reference.

API Resources

The following API resources can be of help to you in getting started with Aspose.Email API.