RDOSession object

 

RDOSession object is the top level object in the RDO object hierarchy from which all other objects are retrieved. To be able to use RDOSession object properties and methods, log on to a MAPI session first by either setting the MAPIOBJECT property or calling Logon, LogonExchangeMailbox or LogonPstStore methods.

 

The example below logs to the default MAPI session and prints out the subjects of all messages in the Inbox folder:

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

 

The example below connects to the MAPI session used by Outlook (Application object below refers to an instance of the Outlook.Application object) and prints out the subjects of all messages in the Inbox folder:

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

 

Properties

Methods

Events

 


Derived from: IDispatch


Properties:


Accounts

RDOAccounts, read-only. Returns the collection representing mail, store and address book accounts in the current profile.

Outlook 2002 and up only.

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Accounts = Session.Accounts
for each Account in Accounts
  Debug.Print Account.Name
next

AddressBook

RDOAddressBook, read-only. Returns the object exposing the Address Book related functionality

set AB = Session.AddressBook
set Recips = AB.ShowAddressBook

MsgBox "You have selected " & Recips.Count & " recipients"

AuthKey

string, write-only. Sets the authentication key - see Security.

 

Categories

returns RDOCategories collection representing categories from the local machine

 

RDOCategories collection first attempts to read the category list from the default store in the profiles (where Outlook 2007 stores it). If no categories are present in the default store, Redemption tries to read the categories list from the registry if Outlook 2003 or older is installed.

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Categories = Session.Categories
for each Category in Categories
   Debug.Print Category.Name
next

 

ConnectEncryptData Boolean, read/write.

Setting this property to true forces LogonExchangeMailbox method to set the PR_PROFILE_UI_STATE property to 0x4100 to force MAPI to encrypt the data.
Set oRDOSession = CreateObject("Redemption.RDOSession")
oRDOSession.ParentWindow = Application.ActiveExplorer
oRDOSession.ConnectEncryptData = true
oRDOSession.LogonExchangeMailbox "dmitry streblechenko", "myserver.com"
ConnectIgnoreNoPF Boolean, read/write.

Setting this property to true forces LogonExchangeMailbox method to set the CONNECT_IGNORE_NO_PF bit in the PR_PROFILE_CONNECT_FLAGS property to tell MAPI that it is Ok to connect even if the PF store is not available.

Note that only Outlook 2010 and the standalone version of MAPI understand this property.
 

CurrentUser

RDOAddressEntry, read-only. Returns the address entry representing the default user identity in the current MAPI session

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon

MsgBox "Current user's name: " & Session.CurrentUser.Name

 

CurrentWindowsUser

RDOAddressEntry, read-only. Returns the address entry representing the identity of the current Windows user.

Accessing this property does not require an active MAPI session, i.e. it can be accessed even if Logon method had not been called.

Note that the properties of the current Windows user are retrieved directly from the Active Directory, which means the parent process must be running under an identity of a domain user and the AD server must be accessible.

 

Note: the following RDOAddressEntry properties will return null in the current version: Delegates, IsDelegateFor, IsMemberOfDL, Reports

 

set Session = CreateObject("Redemption.RDOSession")
MsgBox "Your SMTP address is " & Session.CurrentWindowsUser.SmtpAddress

ExchangeConnectionMode

Returns an rdoExchangeConnectionMode constant that indicates the current connection mode the user is using. Read-only.

rdoExchangeConnectionMode can be one of the following constants:
 

olCachedConnectedDrizzle

600

The account is using cached Exchange mode such that headers are downloaded first, followed by the bodies and attachments of full items.

olCachedConnectedFull

700

The account is using cached Exchange mode on a Local Area Network or a fast connection with the Exchange server. The user can also select this state manually, disabling auto-detect logic and always downloading full items regardless of connection speed.

olCachedConnectedHeaders

500

The account is using cached Exchange mode on a dial-up or slow connection with the Exchange server, such that only headers are downloaded. Full item bodies and attachments remain on the server. The user can also select this state manually regardless of connection speed.

olCachedDisconnected

400

The account is using cached Exchange mode with a disconnected connection to the Exchange server.

olCachedOffline

200

The account is using cached Exchange mode and the user has selected Work Offline from the File menu.

olDisconnected

300

The account has a disconnected connection to the Exchange server.

olNoExchange

0

The account does not use an Exchange server.

olOffline

100

The account is not connected to an Exchange server and is in the classic offline mode. This also occurs when the user selects Work Offline from the File menu.

olOnline

800

The account is connected to an Exchange server and is in the classic online mode.

 

 

ExchangeMailboxServerName

Returns a String value that represents the name of the Exchange server on which the active mailbox is hosted. Read-only.

 

 

ExchangeMailboxServerVersion

Returns a String value that represents the full version of the Exchange server on which the active mailbox is hosted.

If Exchange is not used by the current profile, an empty string is returned.

Read-only.

 

 

FastShutdownSupported

Boolean, read-only. Returns true if the current version of Outlook and all providers in the profile support fast shutdown.

Only Outlook 2007 SP2 or higher supports fast shutdown.

 

See the following for more information:

http://blogs.msdn.com/stephen_griffin/archive/2009/03/03/fastest-shutdown-in-the-west.aspx

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
Debug.Print "Stores in the profile: " & Session.Stores.Count
if Session.FastShutdownSupported Then
    Session.DoFastShutdown
Else
    Session.Logoff
End If

 

JunkEmailOptions

Returns RDOJunkEmailOptions object representing profile-wide Junk E-mail options, which are saved in the profile data (registry) as well as the primary message store in case of an Exchange mailbox.

Profile and mailbox options are reconciled based on the last modification time.

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set JunkOptions = Session.JunkEmailOptions
for each address in JunkOptions.BlockedSenders
    Debug.Print address
next

 

LoggedOn

boolean, read-only. Returns true if logged on, false otherwise.

if not Session.LoggedOn Then

  Session.Logon

End If

 

MAPIOBJECT

IMAPISession Extended MAPI object, read-write. Allows to set the MAPI session to be used without explicitly logging to a MAPI profile. Useful if RDO is used in an environment where a MAPI session is already available (e.g. a COM add-in).

If you set the MAPIOBJECT property, do not call RDOSession.Logoff as that will render the original session invalid as well.

 

Important note: if you set this property to Namespace.MAPIOBJECT property from the Outlook Object Model and your code is running outside the outlook.exe address space (i.e. it is not a COM add-in) some RDO features (RDOFolder.ACL, RDOPSTStore.PstPath, GetSharedDefaultFolder, GetSharedMailbox, etc) will not function properly due to bugs in the MAPI COM marshaling support.

 

'use the same MAPI object as Outlook

'Namespace is returned from Application.GetNamespace("MAPI") in OOM

set Session = CreateObject("Redemption.RDOSession")

Session.MAPIOBJECT = Namespace.MAPIOBJECT

MAPITimeoutShort
Boolean, read/write.
By default this property is true, which causes Redemption to use the MAPI_TIMEOUT_SHORT flag when logging to a MAPI profile (Logon, LogonExchangeMailbox, LogonPstStore). If one of the MAPI providers does not finish initialization within 5 seconds or so, the call will return MAPI_E_TIME_OUT error.

Reset this property to false if you are accessing Exchange over a slow or high latency network.

 
Offline Boolean. read/write. Sets the "Work Offline" option in the current session.
Note that to affect the Offline state in Outlook, you must use the MAPI session returned from Namespace.MAPIOBJECT property in OOM and run in the outlook.exe address space (which means your code must be in an Outlook COM add-in or a VBA script).
 set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
Session.Offline = true

OutlookVersion

Returns a String value that represents the full version of Outlook. If Outlook is not installed, an empty string is returned.

Read-only.

 

 

ParentWindow

 

Object, read/write.

This can be set either to a window handle (HWND) or to an object that supports the IOleWindow interface (such as Explorer or Inspector objects in the Outlook Object Model).

Setting this property to 1 forces Redemption to use the value returned by the GetForegroundWindow Windows API function, setting it to 2 uses teh value from GetDesktopWindow.

 

Setting that property allows MAPI to display dialog boxes when needed, for example when logging to a profile (Logon, LogonExchangeMailbox), opening a message store (LogonPstStore, AddPstStoreWithPassword, GetStoreFromID, GetSharedMailbox) or when resoling names (ResolveName, Resolve, etc).

This property has no effect when running in a service.

 

set Session = CreateObject("Redemption.RDOSession")
Session.ParentWindow = Application.ActiveExplorer
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set AdrrEntry = Session.AddressBook.ResolveName("d")

 

ProfileName

string, read-only. Returns the name of the currently used MAPI profile.

 

MsgBox Session.ProfileName

Profiles

RDOProfiles, read-only. Returns a collection representing the list of profiles for the current Windows user.

 

set Session = CreateObject("Redemption.RDOSession")
Debug.Print("Default profile: " & Session.Profiles.DefaultProfileName)
Debug.Print("Profiles: ")
Debug.Print("------")
for each Name in Session.Profiles
  Debug.Print(Name)
next

 

Stores

RDOStores, read-only. Returns the collection of stores in the current profile.

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

 

TimeZones

RDOTimezones, read-only. Returns collection representing time zones available in Windows.

set Session = CreateObject("Redemption.RDOSession")
set Timezones = Session.Timezones
for each TZ in Timezones
  Debug.Print TZ.Name
next

 

Version

String, read-only. returns the Redemption file version, e.g. "4.7.0.960"

 

 


Methods


Logoff

 

Logs off from the current MAPI session.

 

Note: If you are setting the RDOSession.MAPIOBJECT property to Namespace.MAPIOBJECT from the Outlook Object Model or another RDOSession, do not call Logoff as it will render the original session invalid.

 

set Session = CreateObject("Redemption.RDOSession")

Session.Logon

MsgBox "There are " & Session.Stores.Count & " stores in the default profile"

 

Logon(ProfileName, Password, ShowDialog, NewSession, ParentWindowHandle, NoMail)

Logs to the specified profile.

ProfileName - string, optional. If ProfileName is not specified or is an empty string, the default profile is used.

Password - string, optional.Presently this parameter is only used by the PST provider if the PST store is protected with a password. This is *not* a Windows account password.

ShowDialog - boolean, optional. If true, the dialog selection dialog is used.

NewSession - boolean, optional. If true, a new MAPI session is created; if false, RDO will try to connect to the existing MAPI session

ParentWindowHandle - integer, optional. Window handle of the window to be used as the parent of the dialogs shown by Logon()

NoMail - boolean, optional. If true, MAPI session is initialized without starting the MAPI spooler.

 

set Session = CreateObject("Redemption.RDOSession")

Session.Logon("Outlook")

 

LogonExchangeMailbox(User, ServerName)

Log to a temporary profile. Exchange only

User - string. Name, address or distinguished name identifying the mailbox, e.g. "UserName", "user@mydomain.com", "/o=MyCompany/.../cn=UserName"

ServerName - name or address of the Exchange server., e.g. "mail", "mail.mydomain.com".

 

set Session = CreateObject("Redemption.RDOSession")
Session.LogonExchangeMailbox("dmitry@", "mail")
MsgBox Session.Stores.Count

LogonPstStore(Path, Format, DisplayName, Password, Encryption)

LogonPstStore method, in addition to the Logon and LogonExchangeMailbox methods and setting the MAPIOBJECT property, allows to log to MAPI.

LogonPstStore, similar to the LogonExchangeMailbox method, creates a temporary profile, adds the specified PST store (new or existing) to that temporary profile, and log to the profile. The temporary profile is immediately deleted, so it will never be visible to an end user. LogonPstStore is useful if you need to process a PST file without explicitly creating a new profile using ProfMan and/or without adding the temporary PST store to an existing profile using RDOSession.Stores.AddPstStore:

 

Path - string, required, 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.

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)

 

Returns RDOPstStore object. The same store can be retrieved after calling LogonPstStore from the RDOSession.Stores.DefaultStore.

 

'create initialize first RDOSession object that shared the MAPI session with Outlook
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
'create and initialize a temporary session that uses a new or existing PST file
set TempSession = CreateObject("Redemption.RDOSession")
TempSession.LogonPstStore "c:\temp\archive_test.pst", 1, "Archive PST Store"
'delete all folders in the temporary PST store to make sure there is no collision
set ArchiveRootFolder = TempSession.Stores.DefaultStore.IPMRootFolder
set SubFolders = ArchiveRootFolder.Folders
for i = SubFolders.Count to 1 step - 1
    SubFolders.Remove(i)
next
'copy the contents of the default store used by the first session
'to the PST file used by the second session

for each Folder in Session.Stores.DefaultStore.IPMRootFolder.Folders
    Folder.CopyTo(ArchiveRootFolder)
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

 

GetFolderFromPath(FolderPath)

Returns an RDOFolder object given its full path, e.g. "\\Personal Folders\Inbox". Note that a folder path (unlike the entry id) is not guaranteed to be unique, e.g. you can have multiple stores called "Personal Folders", in which case GetFolderFromPath can fail.

FolderPath - string, full folder path in the form "\\Store name\Parent Folder Name\Folder". If store name is not specified, the default store is assumed.

 

 

GetMessageFromMsgFile(FileName, CreateNew)

Returns an RDOMail object created on top of a specified MSG file.

FileName - string. A fully qualified path to the MSG file (e.g. "c:\temp\test.msg").

CreateNew - Boolean, optional (default value is false). Determines whether RDO opens an existing file (an error will be raised if the file does not exist) or creates a new MSG file.

 

'open an existing MSG file

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Msg = Session.GetMessageFromMsgFile("c:\temp\temp.msg")
msg.Display

 

'create a new MSG file

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Msg = Session.GetMessageFromMsgFile("c:\temp\new.msg", true)
Msg.MessageClass = "IPM.Note"
Msg.Body = "new body"
Msg.Save
Msg.Display

 

CreateMessageFromMsgFile(FileName, MessageType, FileFormat)

Creates a new MSG file and returns a message (RDOMail or one of the derived types, such as RDOContactItem) created on top of MSG file.

 

Unlike RDOSession.GetMessageFromMsgFile (which can also create a new MSG file if CreateNew parameter = true), you can specify the MSG file format (default, Unicode or ANSI) and the message class of the new item so you always get back the right item kind rather than the generic RDOMail.

 

FileName - string. A fully qualified path to the MSG file (e.g. "c:\temp\test.msg").

 

MessageType - variant, optional. Either string specifying the message class (e.g. "IPM.Contact") or one of the rdoItemType values (integer), e.g. olPostItem.

If not specified, "IPM.Note" will be used

 

FileFormat - variant, optional (defaults to mffDefault) , one of the rdoMsgFileFormat enums:

mffDefault = 1 - Unicode under Outlook 2007 or higher, ANSI otherwise
mffUnicode =2 - Unicode MSG file
mffANSI =3 - ANSI MSG file (Outlook 2002 and below)


 

'Create a contact (can be any other type of item) on top of a new MSG file
'Below we will get back a contact since we explicitly specify the message class ("IPM.Contact").
'The MSG file will be created in the Unicode format fro Outlook 2003 or higher or ANSI format
'for the older versions of Outlook (mffDefault = 1)

'The last two parameters are optional
set Session = CreateObject("Redemption.RDOSession")
Session.Logon    'don't really need to call this method
set Contact = Session.CreateMessageFromMsgFile("c:\temp\TestContact.Msg", "IPM.Contact", 1)
Contact.FirstName = "Dmitry"
Contact.LastName = "Streblechenko"
Contact.EMail1Address = "redemption@dimastr.com"
Contact.Save

 

GetMessageFromID(EntryIDMessage, EntryIDStore, Flags)

EntryIDMessage - string representing the entry id of the message

EntryIDStore - (optional). string representing the entry id of the message's parent store.

Flags - (optional). integer flags to be used to call IMAPISession::OpenEntry. 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 MAPI_NO_CACHE (0x200) +  MAPI_BEST_ACCESS (0x10) will open the message in the best access mode bypassing the cached store.

Returns RDOMail object.

 

'using RDO along with the Outlook Object Model

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

'and open the given Outlook.MailItem object as

'Redemption.RDOMail

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Mail = Session.GetMessageFromID(MailItem.EntryID)
MsgBox Mail.SenderName

 

GetFolderFromID(EntryIDFolder, EntryIDStore, Flags)

EntryIDFolder - string representing the entry id of the folder

EntryIDStore - (optional). string representing the entry id of the folder's parent store.

Flags - (optional). integer flags to be used to call IMAPISession::OpenEntry. 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 MAPI_NO_CACHE (0x200) +  MAPI_BEST_ACCESS (0x10) will open the folder in the best access mode bypassing the cached store.

Returns RDOFolder object.

 

'using RDO along with the Outlook Object Model

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

'and open the given Outlook.MAPIFolder object as

'Redemption.RDOFolder

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Folder = Session.GetFolderFromID(MAPIFolder.EntryID)
for each Msg in Folder.Items
  Debug.Print(Msg.Subject)
next

 

GetSelectNamesDialog
Returns RDOSelectNamesDialog object which can be used to display the contents of the address book.
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set ABDialog = Session.GetSelectNamesDialog
ABDialog.ActiveRecipientSelector = olBCC
set Contacts = Session.GetDefaultFolder(olFolderContacts)
if (not (Contacts Is Nothing)) and (Contacts.ShowAsOutlookAB) Then
    ABDialog.InitialAddressList = Contacts.GetAddressList
End If
ABDialog.ShowOnlyInitialAddressList = True
if ABDialog.Display Then
    for each recip in ABDialog.Recipients
        Debug.Print recip.Name & ": " & recip.Address
    next
End If

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

 

GetAddressEntryFromID(EntryID, Flags)

EntryID - string representing the entry id of the address entry object.

Flags - (optional). integer flags to be used to call IAddrBook::OpenEntry. 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 MAPI_NO_CACHE (0x200) +  MAPI_BEST_ACCESS (0x10) will open the address entry in the best access mode bypassing the cached store.

Returns RDOAddressEntry object.

 

 

GetAddressListFromID(EntryID, Flags)

EntryID - string representing the entry id of the address list object.

Flags - (optional). integer flags to be used to call IAddrBook::OpenEntry. 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 MAPI_NO_CACHE (0x200) +  MAPI_BEST_ACCESS (0x10) will open the address list in the best access mode bypassing the cached store.

Returns RDOAddressList object.

 

 

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

 

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.

 

 

GetNicknames(ProfileOrFileName)

 

Returns RDONickNames collection representing nicknames from a particular profile, file or message store.

This method does not require an active MAPI session.

 

ProfileOrFileName - variant, optional. Either a string (profile name of file name) or an RDOStore object.

 

If not specified, and there is no active MAPI session (i.e. you did not call Logon or set the MAPIOBJECT property), will return the nick names for the default profile. If there is an active session, the nicknames form the current profile will be returned.

 

If specified, Redemption will check if the profile with the given name exists (see example) and return nicknames for that profile.

 

If the profile with the given name does not exist, Redemption assumes that a fully qualified file name is specified (e.g. "C:\temp\Nicknames.NK2") and will attempt to open the file.

 

If an RDOStore object is passed, GetNicknames will attempt to retrieve the nicknames stored in a hidden item in the Inbox of the specified store.

 

If neither profile nor file exist, or the no store is specified, an error will be raised.

 

'list all nicknames in all profiles
set Session = CreateObject("Redemption.RDOSession")
for each ProfileName in Session.Profiles
    Debug.Print("-----------------------------")
    Debug.Print("--- " & ProfileName & " --- ")
    Debug.Print("-----------------------------")
    set NickNames = Session.GetNickNames(ProfileName)
    for each NickName in NickNames
        Debug.Print NickName.Name & " - " & NickName.SmtpAddress
    next
next

 

GetRDOObjectFromOutlookObject (OutlookObject, Unwrap)
Returns RDO Object (RDOMail, RDOFolder, etc) form the corresponding Outlook Object Model object.

Normally, to retrieve an RDO object from an Outlook object, it is necessary to call RDOSession.GetMessageFromID. That call however opens another instance of the message, and if modifications are made to both objects, can produce an conflict error. GetRDOObjectFromOutlookObject method will use the MAPIOBJECT property exposed by the Outlook objects in the same manner used by the Safe*Item objects.

OutlookObject - object. The following objects are supported: messages (MailItem, ContactItem, etc), MAPIFolder, AddressEntry, Store, Attachment).

Unwrap - optional, boolean. If true, for messages, Redemption will use IMAPISecureMessage.GetBaseMessage.
For the stores, IProxyStoreObject will be used.

set Session = CreateObject("Redemption.RDOSession")
set Msg = session.GetRDOObjectFromOutlookObject(Application.ActiveInspector.CurrentItem, true)
MsgBox Msg.SaveAs "c:\temp\test.msg", olMsg
GetWindowsUser(Name, NameKind)  Returns an RDOAddressEntry object corresponding to the specified name, which can be a display name, primary SMTP address, NT style user name (domain\user), etc. GetWindowsUser (just like RDOSession.CurrentWindowsUser) does not require an active MAPI session and can be called without calling Logon or LogonExchangeMailbox.

Name - string. Name to be resolved
NameKind - one of the rdoWindowsUserNameKind enum values:

ADS_NAME_TYPE_1779 =1
ADS_NAME_TYPE_CANONICAL = 2
ADS_NAME_TYPE_NT4 = 3
ADS_NAME_TYPE_DISPLAY = 4
ADS_NAME_TYPE_DOMAIN_SIMPLE =5
ADS_NAME_TYPE_ENTERPRISE_SIMPLE =6
ADS_NAME_TYPE_GUID = 7
ADS_NAME_TYPE_UNKNOWN = 8
ADS_NAME_TYPE_USER_PRINCIPAL_NAME = 9
ADS_NAME_TYPE_CANONICAL_EX = 10
ADS_NAME_TYPE_SERVICE_PRINCIPAL_NAME = 11
ADS_NAME_TYPE_SID_OR_SID_HISTORY_NAME = 12

ADS_NAME_TYPE_NT4 = 3
ADS_NAME_TYPE_DISPLAY = 4
ADS_NAME_TYPE_USER_PRINCIPAL_NAME = 9
set Session = CreateObject("Redemption.RDOSession")
set AddressEntry = Session.GetWindowsUser("LITWAREINC\Bob", ADS_NAME_TYPE_NT4)
MsgBox AddressEntry.Name & ": " & AddressEntry.SmtpAddress

CompareEntryIDs(EntryID1, EntryID2)

Checks whether the two entry ids refer to the same MAPI object. Note that entry ids cannot be directly compared and multiple entry ids can refer to the same object (e.g. in case of long term vs. short term entry id).

EntryID1 - string, entry id of the first object

EntryID2 - string, entry id of the second object

 

 

SetLocaleIDs(LocaleID, CodePageID)

The SetLocaleIDs method sets identifiers that define a messaging users locale.

The locale info is only used by the dynamically created profiles when LogonExchangeMailbox is called. If SetLocaleIDs is called after logon, an error will be raised.

LocaleID - integer. The locale identifier (LCID) to be used for this messaging user.

CodePageID - integer. The code page identifier to be used for this messaging user.

 

set Session = CreateObject("Redemption.RDOSession")
Session.SetLocaleIDs 1031, 1252   'German locale with multilingual codepage
Session.LogonExchangeMailbox "dmitry", "vm-w2k3"

 

PickFolder(SelectedFolder, Caption, ParentWindow, Flags, AllowedFolderType)

Displays the Pick Folder dialog box. This is a modal dialog box which means that code execution will not continue until the user either selects a folder or cancels the dialog box. Returns an RDOFolder object corresponding to the folder that the user selects in the dialog box. Returns Nothing when the dialog box is canceled by the user.

 

SelectedFolder - optional, RDOFolder. If specified, this folder will be initially selected. If not specified, the Inbox folder is selected when the dialog is displayed.

 

Caption - optional, string. If specified, determines the Select Folder dialog caption. If not specified, defaults to "Select Folder" (localized appropriately in French/German/Italian/Portugese/Russian/Spanish along with other dialog box controls).

 

ParentWindow - optional, integer. If specified, the handle of the dialog's parent window. If not specified, the dialog is shown as a child of the currently active window.

 

Flags - optional. Can be a combination of the following rdoPickFolderFlags enum values:

 

sffHideNewButton (1) - hides the "New" button, preventing the user from creating a new folder.


pffHideParentFolders (2) - displays only the specified folders and its subfolders (see the screenshot)


pffNoSizing (4) - prevents the user from resizing the dialog.

 

pffHidePublicFoldersStore (8) - hides the Public Folders store but leaves all the other stores visible (unless pffHideParentFolders  is also specified).


AllowedFolderType - optional. One of the rdoItemType enums. If not specified, all folders are displayed. If is specified, only the folders with the DefaultItemType property matching the specified value are displayed.

The following values are supported: olMailItem, olAppointmentItem, olContactItem, olTaskItem, olJournalItem, olNoteItem.

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Folder = Session.PickFolder

If Not (Folder Is Nothing) Then

    MsgBox "You selected  " & Folder.Name

End If

 

 


 

'Allows to select either the Contacts folder or one of its subfolders

sffHideNewButton = 1
sffHideParentFolders = 2
sffNoSizing = 4
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set InitialFolder = Session.GetDefaultFolder(olFolderContacts)
set Folder = Session.PickFolder(InitialFolder, "Please select a contacts folder", ,ffHideParentFolders)

 

 


 

'replacement for Namespace.PickFolder in OOM
'that allows to specify the initial folder

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
'convert Outlook.Folder to Redemption.RDOFolder
set rFolder = Session.GetFolderFromID(Application.ActiveExplorer.CurrentFolder.EntryID)
set rFolder = Session.PickFolder(Folder, "Please select a folder")
if Not (rFolder Is Nothing) Then
    'convert Redemption.RDOFolder back to Outlook.Folder
    set oFolder = Application.Session.GetFolderFromID(rFolder.EntryID)
    MsgBox oFolder.Name
End If

DoFastShutdown

Shuts down MAPI in the current process space. No MAPI calls will be allowed if this method succeeds.

An error will be raised if the current version of Outlook and all providers in the profile do not support fast shutdown.

Only Outlook 2007 SP2 or higher supports fast shutdown.

 

See the following for more information:

http://blogs.msdn.com/stephen_griffin/archive/2009/03/03/fastest-shutdown-in-the-west.aspx

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
Debug.Print "Stores in the profile: " & Session.Stores.Count
if Session.FastShutdownSupported Then
    Session.DoFastShutdown
Else
    Session.Logoff
End If

 


Events:


OnNewMail(EntryID)

Fires when a new message is delivered to the Inbox of the default store.

 

EntryID - string, entry id (in hex) of the newly delivered message. Note that under Exchange, the entry id is a short term entry id. To retrieve the long term entry id, open the message (e.g. using RDOSession.GetMessageFromID), then read the EntryID property from the RDOMail object.

 

Dim WithEvents Session As Redemption.RDOSession
...

Sub Session_OnNewMail(ByVal EntryID As String)
  Dim Msg As Redemption.RDOMail
  Set Msg = Session.GetMessageFromID(EntryID)
  MsgBox "Session_OnNewMail: " & Msg.Subject
End Sub

OnOfflineStateChange Fires when the user clicks on the "Work Offline" button/menu item in Outlook or when the RDOSession.Offline property is set.