This documentation is archived and is not being maintained.

MailItem.Display Method

Office 2007
Displays a new Inspector object for the item.



expression   A variable that represents a MailItem object.


NameRequired/OptionalData TypeDescription
ModalOptionalVariantTrue to make the window modal. The default value is False.


The Display method is supported for explorer and inspector windows for the sake of backward compatibility. To activate an explorer or inspector window, use the Activate method.

If you attempt to open an "unsafe" file system object (or "freedoc" file) by using the Microsoft Outlook object model, you receive the E_FAIL return code in the C or C++ programming languages. In Outlook 2000 and earlier, you could open an "unsafe" file system object by using the Display method.


This Visual Basic for Applications example displays the first item in the Inbox folder. This example will return an error if the Inbox is empty, because you are trying to display a specific item. If there are no items in the folder, a message box will be displayed to inform the user.

Bb175266.vs_note(en-us,office.12).gif  Note
The items in the Items collection object are not guaranteed to be in any particular order.
Visual Basic for Applications
Sub DisplayFirstItem()
    Dim myNameSpace As Outlook.NameSpace
    Dim myFolder As Outlook.Folder
    Set myNameSpace = Application.GetNamespace("MAPI")
    Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
    On Error GoTo ErrorHandler
    Exit Sub
    MsgBox "There are no items to display."
End Sub