Items Object

Microsoft Outlook Visual Basic

Items Object

         
MAPIFolder Items
NameSpace

An object containing 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.

The following Visual Basic for Applications example returns the first item 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 Visual Basic for Applications example returns the first item in the folder.

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

The following VBScript example returns the first item in the folder.

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