How to: Determine the Parent Folder of Unsaved Items

This example determines the parent MAPIFolder of an unsaved contact item.

Applies to: The information in this topic applies to application-level projects for Outlook 2007 and Outlook 2010. For more information, see Features Available by Office Application and Project Type.


private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    Outlook.ContactItem contact =
        this.Application.CreateItem
        (Outlook.OlItemType.olContactItem)
         as Outlook.ContactItem;

    Outlook.MAPIFolder folder =
        contact.Parent as Outlook.MAPIFolder;

    MessageBox.Show(folder.Name);
}


Community Additions

ADD
Show: