Item Property (AddressEntries Collection)

Item Property (AddressEntries Collection)

The Item property returns a single AddressEntry object from the AddressEntries collection. Read-only.

Syntax

objAddrEntriesColl.Item(index)

objAddrEntriesColl.Item(searchValue)

index

A long integer ranging from 1 to the size of the AddressEntries collection.

searchValue

A string used to search the AddressEntries collection starting at the current position. The search returns the next AddressEntry object having the current sorting property greater than or equal to the searchValue string.

The Item property is the default property of an AddressEntries collection, meaning that objAddrEntriesColl**(index)** is syntactically equivalent to objAddrEntriesColl.**Item(index)**in Microsoft® Visual Basic® code.

Data Type

Object (AddressEntry)

Remarks

Programmers needing to access individual objects in a large collection are strongly advised to use the Visual Basic For Each statement or the Get methods, particularly GetFirst and GetNext.

The Item(index) syntax returns the AddressEntry object at the indicated position in the collection. It can be used in an indexed loop, such as the For ... Next construction in Visual Basic. The first item in the collection has an index of 1.

For more information on using the Count and Item properties in a large collection, see the example in the Count property.

The Item(searchValue) syntax returns the next AddressEntry object whose current sorting property is greater than or equal to the string specified by searchValue. This syntax starts its search at the current position.

Searching is based on the current sort order of the collection. The default sort property for an AddressEntries collection is the Name property of the collection's AddressEntry objects. If you want to use the Item(searchValue) syntax to search the collection on another property, for example an address type, you should first call the Sort method specifying the Type property.

Note   The Item(searchValue) syntax uses the IMAPITABLE::FindRow method, which performs a search dependent on the current sort order of the table underlying the collection. Not all tables are sorted alphabetically. If your most recent sort order is nonalphabetic, you should access the messages using the Item(index) syntax. This could be the case, for example, if your AddressEntries collection is sorted on the DisplayType property.

For more information on tables, bookmarks, restrictions, and sort and search orders, see the MAPI Programmer's Reference.

Although the Item property itself is read-only, the AddressEntry object it returns can be accessed in the normal manner, and its properties retain their respective read/write or read-only accessibility.

See Also

Concepts

AddressEntries Collection Object