This documentation is archived and is not being maintained.

How to: Determine the Parent Folder of Unsaved Items

Note Required applications

The code example in this topic can be compiled only if you have the required applications installed.

For more information, see Features Available by Product Combination.

  • One of these development environments:

    VSTO 2005

    -or-

    Visual Studio Team System

  • Microsoft Office Outlook 2003

NoteNote

This code does not compile if you use the VSTO 2005 SE version of the Outlook 2003 add-in project template. For more information, see Getting Started Programming Application-Level Add-ins.

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

Example

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

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

    MessageBox.Show(folder.Name);
}

See Also

Show: