Jake Wharton
Jake Wharton

Reputation: 76115

Get email folder from MailItem via MAPI interface

I'm creating a program to automatically generate reports from incoming email attachments and it is almost complete save for one area. The incoming emails are automatically filtered into folders which differentiate which client and server they originate from. I can't figure out how to get the path of the folder from the email Item.

I'm using the NewMailEx event to call the method below and this.AppNamespace and this.ReportFolder are confirmed to be instantiated properly.

void AppClass_NewMailEx(string EntryIDCollection)
{
    Outlook.MailItem Item = (Outlook.MailItem)this.AppNamespace.GetItemFromID(EntryIDCollection, this.ReportFolder.StoreID);
    string FolderName = ""; //How do I get this?
}

The MSDN on MailItem is here. Am I missing something or approaching this the incorrect way?

Upvotes: 2

Views: 3527

Answers (1)

Mark Brackett
Mark Brackett

Reputation: 85685

I think there's a Parent that you can check - it should return a MAPIFolder that you can check the Name of.

Upvotes: 5

Related Questions