Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Determine the Parent Folder of Unsaved Items

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Application-level projects

Microsoft Office version

  • Outlook 2003

  • Outlook 2007

For more information, see Features Available by Application and Project Type.

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

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:
© 2015 Microsoft