Export (0) Print
Expand All

How to: Access the Outlook Item that Displays the Form Region

A form region appears when you open an item in Microsoft Office Outlook. You can access the Outlook item in which the form region appears by using the OutlookItem property of the FormRegionControl class.

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.

More than one type of Outlook item can display a form region. You can determine what type of Outlook item is displaying the form region and then cast the Outlook item to that type.

The following example identifies the Outlook item as a mail item and then adds the subject of the mail item to a label on the form region.


private void FormRegion1_FormRegionShowing
    (object sender, System.EventArgs e)
{
    if (this.OutlookItem is Outlook.MailItem)
    {
        if (this.OutlookFormRegion.FormRegionMode == 
            Outlook.OlFormRegionMode.olFormRegionRead)
        {
            Outlook.MailItem mailItem = 
            (Outlook.MailItem)this.OutlookItem;
            label1.Text = "This form region contains information " +
            "about " + mailItem.Subject;
        }
     }

}


Community Additions

ADD
Show:
© 2014 Microsoft