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

Free Support Forum - aspose.com

Similar FromFile method used with MapiMessage but for Outlook Appointments, Task and Read Report types

Was wondering if there is a method that works similarly to FromFile for MapiMessage but for the Outlook types of Appointments, the different types of Task items (taskRequest, taskRequestAccept, taskRequestDecline) and Read Reports. If not, is there a method that can be used to identify what type of email item it is from a filepath?

Hello @miguelsilva,

Pease try the following:

var msg = MapiMessage.Load("my.msg");

switch (msg.SupportedType)
    // A contact item. Can be converted to MapiContact.
    case MapiItemType.Contact:
        var contact = (MapiContact)msg.ToMapiMessageItem();
    // A calendar item. Can be converted to MapiCalendar.
    case MapiItemType.Calendar:
        var calendar = (MapiCalendar)msg.ToMapiMessageItem();
    // A distribution list. Can be converted to MapiDistributionList.
    case MapiItemType.DistList:
        var dl = (MapiDistributionList)msg.ToMapiMessageItem();
    // A Journal entry. Can be converted to MapiJournal.
    case MapiItemType.Journal:
        var journal = (MapiJournal)msg.ToMapiMessageItem();
    // A StickyNote. Can be converted to MapiNote.
    case MapiItemType.Note:
        var note = (MapiNote)msg.ToMapiMessageItem();
    // A Task item. Can be converted to MapiTask.
    case MapiItemType.Task:
        var task = (MapiTask)msg.ToMapiMessageItem();