Compartilhar via


Items Object

Items

An object containing Microsoft Outlook item objects in a folder.

Using the Items Object

Use the Items property to return the Items object of a MAPIFolder object.

Use Items(index), where index is the name or index number, to return a single Outlook item.

Note  In Office Outlook   2003, the items in the Items collection object are not guaranteed to be in any particular order.

The following Microsoft Visual Basic for Applications (VBA) example returns the first item in the Inbox with the Subject "Need your advice."

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
Set myFolder = _
    myNameSpace.GetDefaultFolder(olFolderInbox)
Set myItem = myFolder.Items("Need your advice")

The following VBA example returns the first item in the Inbox. In Office Outlook   2003, the Items object returns the items in an Offline Folders file (.ost) in the reverse order.

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
Set myFolder = _
    myNameSpace.GetDefaultFolder(olFolderInbox)
Set myItem = myFolder.Items(1)

The following Microsoft Visual Basic Scripting Edition (VBScript) example returns the first item in the Inbox. In Office Outlook   2003, the Items object returns the items in an Offline Folders file (.ost) in the reverse order.

Set myNameSpace = Application.GetNameSpace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(6)
Set myItem = myFolder.Items(1)

Properties | Application Property | Class Property | Count Property | IncludeRecurrences Property | Parent Property | Session Property

Methods | Add Method | Find Method | FindNext Method | GetFirst Method | GetLast Method | GetNext Method | GetPrevious Method | Item Method | Remove Method | ResetColumns Method | Restrict Method | SetColumns Method | Sort Method

Events | ItemAdd Event | ItemChange Event | ItemRemove Event

Parent Objects

Child Objects

See Also | AppointmentItem Object | ContactItem Object | DocumentItem Object | JournalItem Object | MailItem Object | MeetingItem Object | NoteItem Object | PostItem Object | RemoteItem Object | ReportItem Object | TaskItem Object | TaskRequestAcceptItem Object | TaskRequestDeclineItem Object | TaskRequestItem Object | TaskRequestUpdateItem Object