The InfoStores property returns a single InfoStore object or an InfoStores collection available to this session. Read-only.
Set objInfoStoresColl = objSession.InfoStores
Set objOneInfoStore = objSession.InfoStores(index)
Set objOneInfoStore = objSession.InfoStores(name)
Object (InfoStore or InfoStores collection)
The InfoStores property returns a specific message store or a collection of available message stores. Each InfoStore object in the collection represents an individual message store and provides access to its folder hierarchy.
You can access public folders through the InfoStores collection. The public folders are maintained in their own InfoStore object, which is distinct from the message store containing the user's personal messages. The public folders store typically has "Public Folders" in its Name property and is always positioned first in the collection, so that its Index property always has the value 1.
If your application is running as a Microsoft® 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. For more information on Windows NT services, see the Win32® Web page Using MAPI from a Windows NT Service at http://www.microsoft.com/win32dev/mapi/mapiserv.htm.
When you know the unique identifier for a particular InfoStore object, you can obtain it directly with the Session object's GetInfoStore method.
Although the InfoStores property itself is read-only, the collection it returns can be accessed in the normal manner, and the properties on its member InfoStore objects retain their respective read/write or read-only accessibility.
' from the functions Session_InfoStores and InfoStores_FirstItem
Dim objSession as MAPI.Session
Dim objInfoStoresColl as InfoStores
Dim objInfoStore as InfoStore
' assume valid Session object
Set objInfoStoresColl = objSession.InfoStores
If objInfoStoresColl Is Nothing Then
MsgBox "Could not set InfoStores collection"
Exit Function
End If
If 0 = objInfoStoresColl.Count Then
MsgBox "No InfoStores in the collection"
Exit Function
End If
collIndex = 1
Set objInfoStore = objInfoStoresColl.Item(collIndex)
' could be objInfoStoresColl(collIndex) since Item is default property
If objInfoStore Is Nothing Then
MsgBox "Cannot get first InfoStore object"
Exit Function
Else
MsgBox "Selected InfoStores item " & collIndex
End If
If "" = objInfoStore.Name Then
MsgBox "Active InfoStore has no name; ID = " & objInfoStore.Id
Else
MsgBox "Active InfoStore has name: " & objInfoStore.Name
End If