Share via


Item Property (Folders Collection)

Item Property (Folders Collection)

The Item property returns a single Folder object from the Folders collection. Read-only.

Syntax

objFoldersColl.Item(index)

objFoldersColl.Item(searchValue)

index

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

searchValue

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

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

Data Type

Object (Folder)

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 Folder 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 Folder 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.

Prefix searching is based on the current sort order of the collection. The default sort property for a Folders collection is the Name property of the collection's Folder objects. If you want to use the Item(searchValue) syntax to search the collection on another property, for example a parent folder ID, you should first call the Sort method specifying the FolderID 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. The Microsoft Exchange Public Folders folder, for example, is held in a nonalphabetic order, and you should access its subfolders using the Item(index) syntax.

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

If your application is running as a Windows NT® service, you cannot access the Microsoft Exchange Public Folders through the normal hierarchy because of a notification conflict. You must use the InfoStore object's Fields property to obtain the Microsoft Exchange property PR_IPM_PUBLIC_FOLDERS_ENTRYID, property tag &H66310102. This represents the top-level public folder and allows you to access all other public folders through its Folders property.

Although the Item property itself is read-only, the Folder 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

Folders Collection Object