Items Property

Microsoft Outlook Visual Basic

Items Property

       

Returns an Items collection as a collection of Outlook items in the specified folder.

expression.Items

expression    Required. An expression that returns a MAPIFolder object.

Example

This Visual Basic for Applications example uses the Items property to obtain the collection of MailItem objects from the default Inbox folder.

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

If you use VBScript, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript.

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