RDOStores object collection

 

RDOStores collection represents the message stores list in a given profile.

Returned by: RDOSession.Stores

 

The example below logs to the default MAPI session and prints out the file names of the PST stores and Server Distinguished Names for the Exchange stores

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
for each Store in Session.Stores
  if (Store.StoreKind = skPstAnsi) or (Store.StoreKind = skPstUnicode) Then
    Debug.Print Store.Name & " - " & Store.PstPath
  ElseIf (Store.StoreKind = skPrimaryExchangeMailbox) or (Store.StoreKind = skDelegateExchangeMailbox) or (Store.StoreKind = skPublicFolders) Then
    Debug.Print Store.Name & " - " & Store.ServerDN
  End If
next

 

Properties

Methods

Events

 


Derived from: IDispatch


Properties


Count

integer. Returns the number of stores in the profile

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
MsgBox Session.Stores.Count

DefaultStore

RDOStore, read/write. Returns/sets the default store

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
MsgBox "The name of the default store is" & vbCrLf & Session.Stores.DefaultStore.Name

_Item(Index)

Index - variant: integer or a string. A default object property

Retrieves a store with a give index (1 to Count) or a given name

Returns RDOStore object

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
Set Store = Session.Stores("Personal Folders")
MsgBox Store.Name


Methods


Item(Index, OpenFlags)

Retrieves a store with a give index (1 to Count) or a given name.

Index - variant: integer or a string.

OpenFlags - (optional). integer; flags to be used to call IMAPISession::OpenMsgStore. By default MAPI_BEST_ACCESS (0x10) is used. This parameter is most useful if you need to bypass the cached mode in Outlook 2003. E.g. passing MDB_ONLINE(0x100) +  MAPI_BEST_ACCESS (0x10) will open the store in the best access mode bypassing the cached store.

Returns RDOStore object

 

AddPSTStore(Path, Format, DisplayName)

Adds a PST store to the given profile. Returns an RDOStore object.

Path - string, path to the PST file. If the file does not exist, a new PST store will be created.

Format - integer, optional. The format of the PST file if a new store is to be created. Can be one of the rdoStoreType enums: olStoreDefault (1), olStoreUnicode (2), olStoreANSI (3).

DisplayName - string, optional. The display name of the store if one is to be created.

 

set Session = CreateObject("Redemption.RDOSession")

'use the MAPI session from Outlook Object Model
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Store = Session.Stores.AddPSTStore("c:\temp\test.pst", 1, "Test Store")
MsgBox Store.Name

AddPstStoreWithPassword (Path, Format, DisplayName, Password, RememberPassword, Encryption)

Adds a PST store to the given profile and allows to (optionally) pass the value of the password (both for the existing and new PST files) and the encryption level (for new PST files only). Returns an RDOStore object.

Path - string, path to the PST file. If the file does not exist, a new PST store will be created.

Format - integer, optional. The format of the PST file if a new store is to be created. Can be one of the rdoStoreType enums: olStoreDefault (1), olStoreUnicode (2), olStoreANSI (3).

DisplayName - string, optional. The display name of the store if one is to be created.

Password - string, optional. The PST file pssword.

RememberPassword - boolean, optional. If TRUE, MAPI will remember the password.

Encryption - one of the rdoPstEncryption enums, optional. Specifies the encryption level to be used when creating a new PST file.

psteCompressableEncryption (1)
psteBestEncryption (2)
psteNoEncryption (0)

 

 

AddDelegateExchangeMailBoxStore(UserNameOrAddress)

Adds a delegate Exchange store to the given profile. Returns an RDOStore object. This method provides the same functionality as "Open This Additional Mailboxes" list on the Advanced tab of the Exchange Service Provider options dialog box.

 

UserNameOrAddress- string, name or address of an Exchnage mailbox, e.g. "Joe User" or "joe@mydomain.com".

 

Returns RDOStore object.

 

 

set Session = CreateObject("Redemption.RDOSession")
'use the MAPI session from Outlook Object Model
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
Session.Stores.AddDelegateExchangeMailBoxStore "dmitry"

FindExchangePublicFoldersStore

Returns the Public Folders store

 

 

GetDisplayOrder Returns RDOStoresDisplayOrderList collection, representing the order in which Outlook displays the stores.
 

GetSharedDefaultFolder(NameOrAddressOrObject, FolderType)

NameOrAddressOrObject - can be a string representing the Exchange mailbox name or address or an RDOAddressEntry or an RDORecipient object.

FolderType - integer. The type of the folder. Accepts the same values as Namespace.GetDefaultFolder method in Outlook Object Model (olFolderInbox, olFolderContacts, etc).

Returns RDOFolder object.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Folder = Session.GetSharedDefaultFolder("dmitry", olFolderCalendar)
for each Msg in Folder.Items
  Debug.Print(Msg.Subject)
next

GetDefaultFolder(FolderType)

FolderType - integer. The type of default folder to return. Accepts the same values as Namespace.GetDefaultFolder method in Outlook Object Model (olFolderInbox, olFolderContacts, etc).

Returns RDOFolder object.

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Inbox = Session.GetDefaultFolder(olFolderInbox)
for each Msg in Inbox.Items
  Debug.Print(Msg.Subject)
next

GetSharedMailbox(NameOrAddressOrObject)

Returns RDOStore object representing the given user's mailbox.

NameOrAddressOrObject - can be a string representing the Exchange mailbox name or address or an RDOAddressEntry or an RDORecipient object.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Store = Session.GetSharedMailbox("dmitry")

MsgBox "The address of the mailbox owner: " & Store.Owner.Address

 

GetSharedMailboxEx (NameOrAddressOrObject, EntryIDFlags, OpenStoreFlags)

 

Returns IRDOExchangeStore object representing the given user's mailbox.

Similar to GetSharedMailbox, but allows to provide various flags used when creating the store entry id (use Admin privilege etc) and opening the store.

 

NameOrAddressOrObject - can be a string representing the Exchange mailbox name or address or an RDOAddressEntry or an RDORecipient object.

 

EntryIDFlags - a combination of rdoCreateStoreEntryIDFlags enums (see below). GetSharedMailbox method uses OPENSTORE_HOME_LOGON | OPENSTORE_TAKE_OWNERSHIP.

 

OPENSTORE_USE_ADMIN_PRIVILEGE (0x00000001)
OPENSTORE_PUBLIC (0x00000002)
OPENSTORE_HOME_LOGON (0x00000004)
OPENSTORE_TAKE_OWNERSHIP (0x00000008)
OPENSTORE_OVERRIDE_HOME_MDB (0x00000010)
OPENSTORE_TRANSPORT (0x00000020)
OPENSTORE_REMOTE_TRANSPORT (0x00000040)
OPENSTORE_INTERNET_ANONYMOUS (0x00000080)
OPENSTORE_ALTERNATE_SERVER (0x00000100)
OPENSTORE_IGNORE_HOME_MDB (0x00000200)
OPENSTORE_NO_MAIL (0x00000400)
OPENSTORE_OVERRIDE_LAST_MODIFIER (0x00000800)
OPENSTORE_CALLBACK_LOGON (0x00001000)
OPENSTORE_LOCAL (0x00002000)
OPENSTORE_FAIL_IF_NO_MAILBOX (0x00004000)
OPENSTORE_CACHE_EXCHANGE (0x00008000)
OPENSTORE_CLI_WITH_NAMEDPROP_FIX (0x00010000)
OPENSTORE_ENABLE_LAZY_LOGGING (0x00020000)
OPENSTORE_CLI_WITH_REPLID_GUID_MAPPING_FIX (0x00040000)
OPENSTORE_NO_LOCALIZATION (0x00080000)
OPENSTORE_RESTORE_DATABASE (0x00100000)
OPENSTORE_XFOREST_MOVE (0x00200000)

 

 

OpenStoreFlags- flags to be used when calling IMAPISession::OpenMsgStore. GetSharedMailbox method uses MDB_NO_DIALOG | MAPI_BEST_ACCESS | MDB_TEMPORARY | MDB_NO_MAIL.

 

 

GetArchiveMailbox

(NameOrAddressOrObject, EntryIDFlags, OpenStoreFlags)

Returns IRDOExchangeStore object representing the given user's archive mailbox (Exchange 2010 or newer only)

 

NameOrAddressOrObject - can be a string representing the Exchange mailbox name or address or an RDOAddressEntry or an RDORecipient object.

 

EntryIDFlags - Optional, variant. A combination of rdoCreateStoreEntryIDFlags enums (see GetSharedMailboxEx  above). If not specified, OPENSTORE_HOME_LOGON | OPENSTORE_TAKE_OWNERSHIP are used.

 

OpenStoreFlags-  Optional, variant. Flags to be used when calling IMAPISession::OpenMsgStore. (see GetSharedMailboxEx  above) If not specified, MDB_NO_DIALOG | MAPI_BEST_ACCESS | MDB_TEMPORARY | MDB_NO_MAIL are used.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set AddressEntry = Session.CurrentUser
set ArchiveStore = Session.Stores.GetArchiveMailbox(AddressEntry)
for each fld in ArchiveStore.IPMRootFolder.Folders
   
Debug.Print fld.Name
next

GetStoreFromID(EntryIDStore, Flags)

EntryIDStore - string representing the entry id of the store.

Flags - (optional). integer flags to be used to call IMAPISession::OpenMsgStore. By default MAPI_BEST_ACCESS (0x10) is used. This parameter is most useful if you need to bypass the cached mode in Outlook 2003. E.g. passing MDB_ONLINE(0x100) +  MAPI_BEST_ACCESS (0x10) will open the store in the best access mode bypassing the cached store.

Returns RDOStore object.

 

'using RDO along with the Outlook Object Model

'connect to the same MAPI session as the one used by Outlook

'and open the parent store of the given Outlook.MAPIFolder object as

'Redemption.RDOStore

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Store = Session.GetStoreFromID(MAPIFolder.StoreID)
MsgBox Store.Name

UnwrapStore(Store) IMAP4 (and some other) stores are wrappers on top of the PST stores. Accessing messages in such stores can trigger sync with the remote server. If you want to access only locally available objects  in the store, call UnwrapStore to return the original store object that does not trigger the sync.

Store - RDOStore. The original store to be unwrapped. If the store is not wrapped, the original store object is returned.

Returns (unwrapped) RDOStore object.

 set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Stores = Session.Stores
for each Store in Stores
    set UnwrappedStore = Stores.UnwrapStore(Store)
    Debug.Print "-- " & UnwrappedStore.Name & " --"
    set Inbox = UnwrappedStore.GetDefaultFolder(olFolderInbox)
    for each Msg in Inbox.Items
        Debug.Print " " & Msg.Subject
    next
next

 


Events:


StoreChange(Store)

Fires when a store is modified.

Store - RDOStore object

 

StoreAdd(Store)

Fires when a new store is added to the list of stores in the current MAPI session.

Store - RDOStore object

Dim WithEvents Stores As Redemption.RDOStores

...

Set Session = New Redemption.RDOSession

Session.Logon
Set Stores = Session.Stores
...

Sub Stores_StoreAdd(ByVal Store As RDOStore)
  MsgBox "New store added: " & Store.Name
End Sub

StoreRemove(InstanceKey)

Fires when a store is removed from the list of stores.
By the time this asynchronous even is fired, the store is already deleted, hence no entry id is available.

InstanceKey - a hex value of the PR_INSTANCE_KEY property of the deleted table row. Note that PR_INSTANCE_KEY is not available from the store itself, only from the MAPI table (see MAPITable property). InstanceKey is only guaranteed to be the same for the same instance of the table, hence this event is useful only if the value of PR_INSTANCE_KEY was previously cached.

 

CollectionModified

Fires when the stores table is modified and the MAPI cannot provide more detailed information about the change, e.g. when too many stores were modified at the same time.

When the event fires, it must be assumed that the entire contents of the collection are no longer valid.