Browse our Products

Aspose.Email for .NET 22.11 Release Notes

All Changes

KeySummaryCategory
EMAILNET-40856Add DecodeSignedContent method to MapiMessageFeature
EMAILNET-40783Provide API to check subfolder is from StandardIpmFolderFeature
EMAILNET-40808Add features for TNEFFeature
EMAILNET-40814Working with StickyNote, DistList and IPM.DocumentEnhancement
EMAILNET-40839Issues while reading distribution ListBug
EMAILNET-40826Storage.ItemMoved event does not workBug
EMAILNET-40825InvalidOperationException is thrown while merging PSTBug
EMAILNET-40828Unable to access read only storage fileBug
EMAILNET-40793Headers From/To are lost after MSG to EML conversionBug
EMAILNET-40854Image attachments are not rendered in the attachments list after MSG to PDF conversionBug
EMAILNET-40840Aspose.Email.AsposeArgumentOutOfRangeException is thrown while loading VCSBug
EMAILNET-40813MSG to MHTML: Images not convertedBug
EMAILNET-40833Email address with quotesBug

New Features

Getting a MAPI item type

We have added the MapiItemType enum that represented an item type. It can be used for message conversion into an object of a corresponding class derived from the IMapiMessageItem interface. This avoids users from checking the MessageClass property value before message conversion.

Usage:

foreach (var messageInfo in folder.EnumerateMessages())
{
    var msg = pst.ExtractMessage(messageInfo);

    switch (msg.SupportedType)
    {
        // Non-supported type. MapiMessage cannot be converted to an appropriate item type.
        // Just use in MSG format.
        case MapiItemType.None:
            break;
        // An email message. Conversion isn't required.
        case MapiItemType.Message:
            break;
        // A contact item. Can be converted to MapiContact.
        case MapiItemType.Contact:
            var contact = (MapiContact)msg.ToMapiMessageItem();
            break;
        // A calendar item. Can be converted to MapiCalendar.
        case MapiItemType.Calendar:
            var calendar = (MapiCalendar)msg.ToMapiMessageItem();
            break;
        // A distribution list. Can be converted to MapiDistributionList.
        case MapiItemType.DistList:
            var dl = (MapiDistributionList)msg.ToMapiMessageItem();
            break;
        // A Journal entry. Can be converted to MapiJournal.
        case MapiItemType.Journal:
            var journal = (MapiJournal)msg.ToMapiMessageItem();
            break;
        // A StickyNote. Can be converted to MapiNote.
        case MapiItemType.Note:
            var note = (MapiNote)msg.ToMapiMessageItem();
            break;
        // A Task item. Can be converted to MapiTask.
        case MapiItemType.Task:
            var task = (MapiTask)msg.ToMapiMessageItem();
            break;
    }
}

Removing a Signature from a MapiMessage

For better compatibility, the MapiMessage.RemoveSignature method and MapiMessage.IsSigned property were added.

Code example:

var msg = MapiMessage.Load(fileName);

if (msg.IsSigned)
{
    var unsignedMsg = msg.RemoveSignature();
}

Checking whether the folder is in a predefined folder

Added FolderInfo.GetPredefinedType(bool getForTopLevelParent) method, to check folder is from StandardIpmFolder.

If getForTopLevelParent param is true, method returns a StandardIpmFolder enum value for the top-level parent folder. This determines whether the current folder is a subfolder of a predefined folder. If getForTopLevelParent param is false, it returns a StandardIpmFolder enum value for the current folder.

string fileName = "my.pst");

using (var pst = PersonalStorage.FromFile(fileName))
{
    CheckFolders(pst.RootFolder.GetSubFolders());
}

private void CheckFolders(FolderInfoCollection folders)
{
    foreach (var folder in folders)
    {
        Console.WriteLine($"Display Name: {folder.DisplayName}");

        // Determines whether the current folder is a predefined folder
        var folderType = folder.GetPredefinedType(false);
        var answer = folderType == StandardIpmFolder.Unspecified ? "No" : $"Yes, {folderType}"; 
        Console.WriteLine($"Is StandardIpmFolder?: {answer}");

        // Determines whether the current folder is a subfolder of a predefined folder
        if (folderType == StandardIpmFolder.Unspecified)
        {
            folderType = folder.GetPredefinedType(true);
            answer = folderType == StandardIpmFolder.Unspecified ? "No" : $"Yes, {folderType}";
            Console.WriteLine($"Is subfolder from StandardIpmFolder parent?: {answer}");
        }

        Console.WriteLine();

        CheckFolders(folder.GetSubFolders());
    }
}

Checking whether attachment is a TNEF formatted message

The Attachment.IsTnef property indicates whether the message attachment is TNEF formatted message.

Usage:

var eml = MailMessage.Load(fileName);

foreach (attachment in eml.Attachments)
{
    Console.WriteLine($"Is Attachment TNEF?: {attachment.IsTnef}");
}