Share via


Items Object

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

MAPIFolder
Aa158715.parchild(en-us,office.10).gifItems
Aa158715.space(en-us,office.10).gifAa158715.parchild(en-us,office.10).gifNameSpace

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)