RDOAccount object

 

RDOAccount object represents an Outlook account (mail, store or address book).

 

Other account objects are derived from the RDOAccount object and, in addition to the RDOAccount properties and methods, they implement properties and methods specific to the particular provider (such as RDOPOP3Account.POP3_Server property for the POP3/SMTP accounts).

It can be one of the following objects (all derived from the RDOAccount object). Check the RDOAccount.AccountType property.

RDOPOP3Account - POP3/SMTP accounts

RDOMAPIAccount - MAPI accounts

RDOIMAPAccount - IMAP4 accounts

RDOHTTPAccount - HTTP (Hotmail, MSDN, etc) accounts

RDOLDAPAccount (derived from RDOMAPIAccount)- LDAP accounts

RDOExchangeAccount (derived from RDOMAPIAccount - Exchange account (includes primary, delegate and Public Folders stores)

RDOPSTAccount (derived from RDOMAPIAccount) - PST store account

RDOEASAccount (derived from RDOMAPIAccount) - EAS (Exchange Active Sync) store account

 

 

Returned by:

RDOAccounts.Item(Index)

RDOMail.Account

RDOStore.StoreAccount

 

The example below prints out POP3 server names for all POP3/SMTP accounts in the profile:

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Accounts = Session.Accounts
for each Account in Accounts
  if Account.AccountType = 0 Then 'atPOP3
    Debug.Print "POP3 server for account " & Account.Name & ": " & Account.POP3_Server
  end if
next

 

 


Derived from: IDispatch


Properties


AccountCategories

Integer, read-only. A combination of the rdoAccountCategory enums (acStore = 1, acMail = 2, acAddressBook = 4).

E.g. if the account provider implements both store and mail transport, the returned value will be 3 (acStore + acMail).

 

 

AccountType

rdoAccountType, read-only.

Can be one of the following values:

atPOP3 = 0
atIMAP = 1
atHTTP = 2
atExchange = 3
atMAPI = 4
atLDAP = 5
atOther = 6

atPST = 7
atEAS = 8

 

 

See example above

AccountTypeStr

String, read-only. Returns the textual description of the account type, e.g. "MAPI", "LDAP", "POP/SMTP", etc.

 

 
CurrentUser
Read-only, RDOAddressEntry.
Returns the user identity of the acount.

Note that some accounts (such as RDOPSTAccount or RDOLDAPAccount) do not provide user identity and return null.

set Session = CreateObject("Redemption.RDOSession")

Session.MAPIOBJECT = Application.Session.MAPIOBJECT

set Accounts = Session.Accounts

for each Account in Accounts

  Debug.Print Account.Name & " (" & TypeName(Account) & ")"

  set user = Account.CurrentUser

  if (user Is Nothing) Then

    Debug.Print "  <no identity>"

  Else

    Debug.Print "  " & user.Name & " (" & user.Address & ")"

  End If

next

Fields(PropTag)

Allows to read or set the account properties directly.

Returns or sets a variant of the type consistent with the property type (e.g. Variant string for the PT_UNICODE properties).

 

'print out account names using Account.Fields()

PROP_ACCT_NAME = &H0002001F
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Accounts = Session.Accounts
for each Account in Accounts
  Debug.Print Account.Fields(PROP_ACCT_NAME)
next

 

ID

Integer, read-only. Returns the account ID. Corresponds to the PROP_ACCT_ID property.

 

 

IsExchange

Boolean, read-only. Returns TRUE if the account is handled by the Exchange Server provider.. Corresponds to the PROP_ACCT_IS_EXCH property.

 

 

JunkEmailOptions
Returns JunkEmailOptions object representing per-account (mail accounts only) junk mal options.
 

Name

String, read-only. Returns the account name. Corresponds to the PROP_ACCT_NAME property.

 

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

 

NewMessageSignature
RDOSignature, read/write. Returns or sets the signature used for the new messages sent using the given account.

Applicable to the mail accounts only.

set Session = CreateObject("Redemption.RDOSession")

Session.MAPIOBJECT = Application.Session.MAPIOBJECT

set Drafts = Session.GetDefaultFolder(olFolderDrafts)

set Msg = Drafts.Items.Add

Msg.To = "dmitry@dimastr.com"

Msg.Subject = "testing signatures"

Msg.HTMLBody = "<html><body>some <b>bold</b> message text</body></html>"

set Account = Session.Accounts.GetOrder(2).Item(1) 'first mail account

if Not (Account Is Nothing) Then

  set Signature = Account.NewMessageSignature

  if Not (Signature Is Nothing) Then

    Signature.ApplyTo Msg, false 'apply at the bottom

  End If

End If

Msg.Display

ReplySignature
RDOSignature, read/write. Returns or sets the signature used for the reply messages sent using the given account..

Applicable to the mail accounts only.
See the example above.

SendStamp

String, read-only. Returns the account send stamp. Corresponds to the PROP_ACCT_SEND_STAMP property.

 

 

Session

Returns the parent RDOSession object. Read-only.

 

 

Stamp

String, read-only. Returns the account stamp. Corresponds to the PROP_ACCT_STAMP property.

 

 


Methods


Save

Saves the changes to the account.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Accounts = Session.Accounts
for each Account in Accounts
  if Account.AccountType = 0 Then 'atPOP3
    Account.DaysBeforeDelete = 5
    Account.Save
  end if
next

 

Delete

Deletes the account from the profile.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Account = Session.Accounts.Item("My ISP account")

Account.Delete

 

 

 

 

 

RDOPOP3Account object

 

RDOPOP3Account object represents an Outlook POP3/SMTP account.

 


Derived from: RDOAccount


Properties


DeleteFromServerAfterXDays

Boolean, read/write. Determines whether the messages are deleted from the POP3 server after the specified number of days. See DaysBeforeDelete property

 

 

DeleteFromServerWhenDeletedLocally

Boolean, read/write. If TRUE, the messages on the POP3 server are deleted when they are deleted from the local Deleted Items folder

 

 

DaysBeforeDelete

Number of days before the messages are deleted from the POP3 server. Only used if DeleteFromServerAfterXDays property is TRUE.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Accounts = Session.Accounts
for each Account in Accounts
  if Account.AccountType = 0 Then 'atPOP3
    Account.DaysBeforeDelete = 5
    Account.Save
  end if
next

 

DeliverToFolder

RDOFolder, read/write. Specifies the folder where the messages retrieved from the given POP3/SMTP account will be delivered to.

 

This is property is Outlook 2007 specific; in the older versions, the default Inbox folder from the store specified by the DeliverToStore property will be used and the changes made to this property will be ignored by Outlook.

 

When set, the DeliverToStore  property (see below) will be adjusted appropriately.

 

 

DeliverToStore 

RDOStore, read/write. Specifies the store where the messages retrieved from the given POP3/SMTP account will be delivered to.

 

When the property is set, Inbox and Sent Items folders in the specified store will be created if they are not yet present.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Account = Session.Accounts("test@dimastr.com")

set Store = Session.Stores.AddPstStore("c:\temp\NewStore", 1, "Store for test@dimastr.com")
Account.DeliverToStore = Session.Stores.DefaultStore
Account.Save

 

LeaveMessagesOnServer

Boolean, read/write. If TRUE, the messages are left on the POP3 sevrer.

 

Organization

String, read/write. The name of the organization.

 

 

POP3_Password string, read/write.
Reads or sets the POP3 password.
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Account = Session.Accounts("gregory@dimastr.com")
Account.POP3_Password = "MyNewPassword"

POP3_Port

Integer, read/write. The TCP/IP port number used to communicate with the POP3 server. The default POP3 port is 110.

 

 

POP3_Server

String, read/write. The name of the POP3 server, e.g. mail.mydomain.com.

 

 

POP3_RememberPassword

Boolean, read/write. If TRUE, Outlook will remember the POP3 password. If FALSE, the user will be prompted for credentials every time the password is required.

 

 

POP3_UserName

String, read/write. The user name used to log on to the POP3 server.

 

 

POP3_UseSPA

Boolean, read/write. Determines whether Secure Password Authentication (SPA) is used when authenticating with the POP3 server.

 

 

POP3_UseSSL

Boolean, read/write. Determines whether Secure Socket Layer (SSL) is used to communicate with the POP3 server.

 

 

ReplyAddress

String, read/write. The address to which e-mail replies will be sent by the recipients of the messages sent through this POP3/SMTP account.

 

 

SaveSentMessageFolder

RDOFolder, read-only. Specifies the folder where the messages sent using the given POP3/SMTP account will be saved.

 

 

SMTPAddress

String, read/write. The SMTP address of the user.

 

 

SMTP_EncryptionType
Specifies the encryption used when sending through the SMTP server, read/write.

cetNone = 0
cetSSL = 1
cetTLS =2
cetAuto = 3
 

SMTP_LogonKind

rdoSMTPLogonKind, read/write. One of the following values can be used:

lkSameAsIncoming = 0,
lkUseSMTPCredentials = 1,
lkLogToIncomingFirst = 2

 

 

SMTP_Password
String, read/write.
Reads or sets the SMTP password.
 

SMTP_Port

Integer, read/write. The TCP/IP port number used to communicate with the SMTP server. The default SMTP port is 25.

 

 

SMTP_Server

String, read/write. The name of the SMTP server, e.g. mail.mydomain.com.

 

 

SMTP_UseAuth

Boolean, read/write. Determines whether authentication is required when communicating with the SMTP server. See SMTP_LogonKind property.

 

 

SMTP_UserName

String, read/write. The user name used to log on to the POP3 server.

See the SMTP_UseAuth and SMTP_LogonKind properties.

 

 

SMTP_UseSPA

Boolean, read/write. Determines whether Secure Password Authentication (SPA) is used when authenticating with the SMTP server

 

 

SMTP_UseSSL

Boolean, read/write. Determines whether Secure Socket Layer (SSL) is used to communicate with the SMTP server.

 

 

TimeOut

Integer, read/write. Timeout (in sec) used when communicating with the POP3 and SMTP servers.

 

 

UserName

String, read/write. The display of the user to be used when sending messages though SMTP (e.g. "Joe The User").

 

 


 

 

 

RDOMAPIAccount object

 

RDOMAPIAccount object represents an Outlook MAPI account (such a PST store).

 


Derived from: RDOAccount


Properties


     

ServiceName

String, read-only. The MAPI service name of the account, e.g. "CONTAB" or "MSPST MS".

 

 

ServiceUID

String, read-only. Returns a hex string representing PR_SERVICE_UID property of the MAPI service from the IMsgServiceAdmin::GetMsgServiceTable table.

 

 

 

 

RDOIMAPAccount object

 

RDOIMAPAccount object represents an Outlook IMAP4/SMTP account.

 


Derived from: RDOAccount


Properties


DoNotSaveSentItems
Boolean. read/write. True if "Do not save copies of sent items" option is checked in the IMAP4 account properties.
 

EnablePurgeOnSwitch

 

Boolean. read/write. True if "Purge items when switching folders while online" option is checked in the IMAP4 account properties.

 

 

IMAP_EncryptionType
Specifies the encryption used when connecting to the IMAP4 server, read/write.

cetNone = 0
cetSSL = 1
cetTLS =2
cetAuto = 3
 

IMAP_Port

Integer, read/write. The TCP/IP port number used to communicate with the IMAP4 server. The default IMAP4 port is 143.

 

 

IMAP_Password
String, read/write. Reads or sets the IMAP4 password.
 

IMAP_Server

String, read/write. The name of the IMAP4 server, e.g. mail.mydomain.com.

 

 

IMAP_RememberPassword

Boolean, read/write. If TRUE, Outlook will remember the IMAP4 password. If FALSE, the user will be prompted for credentials every time the password is required.

 

 

IMAP_RootPath

String, read/write. The root path to the mailbox on the IMAP4 server.

 

 

IMAP_UserName

String, read/write. The user name used to log on to the IMAP4 server.

 

 

IMAP_UseSPA

Boolean, read/write. Determines whether Secure Password Authentication (SPA) is used when authenticating with the IMAP4 server.

 

 

IMAP_UseSSL

Boolean, read/write. Determines whether Secure Socket Layer (SSL) is used to communicate with the IMAP4 server.

 

 

MarkForDeletion
Boolean. read/write. True if "Mark items for deletion but do not move them automatically" option is checked in the IMAP4 account properties.
 
Organization
String, read/write. The name of the organization.  

ReplyAddress

String, read/write. The address to which e-mail replies will be sent by the recipients of the messages sent through this IMAP4/SMTP account.

 

 

SaveSentMessageFolder

RDOFolder, read-only. Specifies the folder where the messages sent using the given IMAP4/SMTP account will be saved.

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Account = Session.Accounts("dmitry@dimastr.com")
if Account.AccountType = 1 Then 'atIMAP
    MsgBox Account.SaveSentMessageFolder.Name
End If

 

SMTPAddress

String, read/write. The SMTP address of the user.

 

 

SMTP_EncryptionType
Specifies the encryption used when sending through the SMTP server, read/write.

cetNone = 0
cetSSL = 1
cetTLS =2
cetAuto = 3
 

SMTP_LogonKind

rdoSMTPLogonKind, read/write. One of the following values can be used:

lkSameAsIncoming = 0,
lkUseSMTPCredentials = 1,
lkLogToIncomingFirst = 2

 

 

SMTP_Password
String, read/write.
Reads or sets the SMTP password.
 

SMTP_Port

Integer, read/write. The TCP/IP port number used to communicate with the SMTP server. The default SMTP port is 25.

 

 

SMTP_Server

String, read/write. The name of the SMTP server, e.g. mail.mydomain.com.

 

 

SMTP_UseAuth

Boolean, read/write. Determines whether authentication is required when communicating with the SMTP server. See SMTP_LogonKind property.

 

 

SMTP_UserName

String, read/write. The user name used to log on to the POP3 server.

See the SMTP_UseAuth and SMTP_LogonKind properties.

 

 

SMTP_UseSPA

Boolean, read/write. Determines whether Secure Password Authentication (SPA) is used when authenticating with the SMTP server

 

 

SMTP_UseSSL

Boolean, read/write. Determines whether Secure Socket Layer (SSL) is used to communicate with the SMTP server.

 

 

Store

RDOStore, read-only. Returns the store used by the IMAP account.

 

 

TimeOut

Integer, read/write. Timeout (in sec) used when communicating with the POP3 and SMTP servers.

 

 

UserName

String, read/write. The display of the user to be used when sending messages though SMTP (e.g. "Joe The User").

 

 

 

 

 

RDOHTTPAccount object

 

RDOHTTPAccount object represents an Outlook HTTP account (such as Hotmail or MSN).

 


Derived from: RDOAccount


Properties


LoginName

String, read/write. The login name

 

 

Organization

String, read/write. The name of the organization.

 

 

RememberPassword

Boolean, read/write. If TRUE, Outlook will remember the password. If FALSE, the user will be prompted for credentials every time the password is required.

 

 

ReplyAddress

String, read/write. The address to which e-mail replies will be sent by the recipients of the messages sent through this HTTP account.

 

 

Server

String, read/write. The name of the HTTP server, e.g. mail.mydomain.com.

 

 

SMTPAddress

String, read/write. The SMTP address of the user.

 

 

Store

RDOStore, read-only. Returns the store used by the HTTP account.

 

 

UserName

String, read/write. The display of the user to be used when sending messages though SMTP (e.g. "Joe The User").

 

 

UseSPA

Boolean, read/write. Determines whether Secure Password Authentication (SPA) is used when authenticating with the HTTP server.

 

 

 

 

 

RDOLDAPAccount object

 

RDOLDAPAccount object represents an Outlook LDAP address book account.

 


Derived from: RDOMAPIAccount


Properties


EnableBrowsing
Boolean, read/write. If true, enables browsing of the LDAP container without searching first.
Requires server-side support.
 

MaxResults

Integer, read/write. The maximum number of results to return.

 

 
Password
String, read/write. Gets or sets the password used to connect to the LDAP account.
 

Port

Integer, read/write. The TCP/IP port used to communicate with the LDAP server.

 

 

SearchBase

String, read/write. The LDAP search base, e.g. "cn=users"

 

 

SearchTemplate

String, read/write. The search string to be used in the search queries, e.g. "(&(mail=*)(|(mail=%s*)(|(cn=%s*)(|(sn=%s*)(givenName=%s*)))))"

 

 

SearchTimeout

Integer, read/write. Timeout (in sec) used when communicating with the LDAP server.

 

 

ServerName

String, read/write. The name of the LDAP server, e.g. ldap.mydomain.com.

 

 

UserName

String, read/write. The user name used to log in to the LDAP server.

 

 

UseSPA

Boolean, read/write. Determines whether Secure Password Authentication (SPA) is used when authenticating with the LDAP server.

 

 

UseSSL

Boolean, read/write. Determines whether Secure Socket Layer (SSL) is used to communicate with the LDAP server.

 

 



 

RDOExchangeAccount object

 

RDOExchangeAccountobject represents an Exchange account that can include primary mailbox, delegate mailboxes, Public Folder store.

 


Derived from: RDOMAPIAccount


Properties


AllAddressLists
Returns IRDOAddressListsCollection object representing all address lists from the Exchange account.

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Accounts = Session.Accounts
for each Account in Accounts
    if Account.AccountType = 3 Then 'atExchange - we have RDOExchangeAccount object
        for each AE in Account.AllAddressLists
            Debug.Print AE.Name
        next
    end if
next
AllRooms Returns RDOAddressList object representing the All Rooms container (Exchange only). Read-only.

 
AllStores
Returns RDOStoresCollection object representing all stores that belong to the given Exchange account.

 
CachedDelegateStores
Returns RDOStoresCollection object representing all cached delegate stores that belong to the given Exchange account.

StringBuilder sb = new StringBuilder();

foreach (RDOAccount account in session.Accounts)

{

    RDOExchangeAccount exAccount = account as RDOExchangeAccount;

    if (exAccount != null)

    {

        sb.AppendLine($"Exchange account {exAccount.Name}");

        foreach(IRDOStore store in exAccount.CachedDelegateStores)

        {

            sb.AppendLine($"  cached delegate mailbox: {store.Name}");

        }

    }

}

MessageBox.Show(sb.ToString());

 

DelegateStores
Returns RDOStoresCollection object representing all delegate stores that belong to the given Exchange account.

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Accounts = Session.Accounts
for each Account in Accounts
    if Account.AccountType = 3 Then 'atExchange - we have RDOExchangeAccount object
        for each store in Account.DelegateStores
            Debug.Print store.Name
        next
    end if
next

GAL
Returns RDOAddressList object representing the Global Address List container for the Exchange account. Read-only.

 

Inbox

 

RDOFolder2, read-only.

Returns the folder in the primary mailbox store where the messages for that account are delivered.

 

 

PrimaryStore

 

RDOExchangeMailboxStore, read-only.

Returns the primary mailbox store where the messages for that account are delivered.

 

 

 
PublicFoldersStore

RDOExchangePublicFoldersStore, read-only.

Returns the Public Folders store for the account.

 

Can be NULL if the Exchange server does not have the Public Folders store.

 

 
User
RDOAddressEntry, read-only.
Returns address entry object representing the owner of the primary mailbox for this account.
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Accounts = Session.Accounts
for each Account in Accounts
   if Account.AccountType = 3 Then 'atExchange
        Debug.Print Account.User.SmtpAddress
    end if
next

Methods

MakeEwsRequest(Data) Similar to the mailbox.MakeEwsRequestAsync method exposed for the Web (JS) addins by Outlook. Unlike the JavaScript equivalent, MakeEwsRequest in Redemption is synchronous and is expected to run on a secondary thread (see here for more on using Redemption in secondary threads). There are no limitation  which EWS call can be made.
Note that MakeEwsRequest is designed to work in COM (VSTO) addins or Outlook VBA as it intercepts EWS requests made by Outlook itself to extract the credentials. It will work outside of the outlook.exe process only if Outlook cached the credentials or if RDOSession.LogonHostedExchangeMailbox was used to connect to Exchange (which requires explicit credentials). Also note that it is expected that the parent RDOSession object is created well ahead of time (e.g. when the COM/VSTO addin is loaded) prior to calling MakeEwsRequest to allow Redemption sufficient time to collect the credentials after Outlook makes its own EWS calls.


Data - string. XML request payload

Returns XML string with the server reply

"<?xml version=""1.0"" encoding=""utf-8""?>" & _

"<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""" & _

"               xmlns:t=""http://schemas.microsoft.com/exchange/services/2006/types"">" & _

"  <soap:Header><t:RequestServerVersion Version=""Exchange2007_SP1""/></soap:Header>" & _

"  <soap:Body>" & _

"    <GetDelegate xmlns=""http://schemas.microsoft.com/exchange/services/2006/messages""" & _

"                 xmlns:t=""http://schemas.microsoft.com/exchange/services/2006/types""" & _

"                 IncludePermissions=""true"">" & _

"      <Mailbox>" & _

"        <t:EmailAddress>" & smtpAddress & "</t:EmailAddress>" & _

"      </Mailbox>" & _

"    </GetDelegate>" & _

"  </soap:Body>" & _

"</soap:Envelope>"

 

set Session = CreateObject("Redemption.RDOSession")

Session.MAPIOBJECT = Application.Session.MAPIOBJECT

set defaultAccount = Session.Accounts.GetOrder(1).Item(1)

if TypeName(defaultAccount) = "RDOExchangeAccount" Then

  MsgBox "This message box simulates a delay between creating RDOSession object " & _

         "and a call to MakeEwsRequest to allow it to intercept EWS calls made by Outlook"

  Session.CacheAutoDiscoverXml smtpAddress, Application.Session.AutoDiscoverXml 'speed things up

  reply = defaultAccount.MakeEwsRequest(payload)

  MsgBox reply

End If

     




 

RDOPSTAccount object

 

RDOPSTAccount represents an PST store in the profile.

 


Derived from: RDOMAPIAccount


Properties


Store

 

RDOPstStore, read-only.

Returns the PST store that the account represents.

 

 

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Accounts = Session.Accounts
for each Account in Accounts
    if Account.AccountType = 7 Then 'atPST
        Debug.Print Account.Store.PstPath
    end if
next






 

RDOEASAccount object

 

RDOEASAccount represents EAS (Exchange Active Sync) account.

 


Derived from: RDOMAPIAccount


Properties


DeliverToFolder

RDOFolder, read-only.

Returns the folder where the new message from this account are delivered to.

 

 
DeliverToStore

RDOPstStore, read-only.

Returns the store corresponding to the EAS account.

 

 
DeviceID String, read-only. Returns the globally unique device id associated with the current machine, profile and EAS store.
 
Email String, read/write. Returns the email address associated with the EAS mailbox.
 
OstPath String, read-only. Returns the fully qualified file name of the OST file where the cached store messages are stored.
 
RememberPassword Boolean, read/write. If true, EAS provider will remember the password.
 
Password String, read/write. The EAS account password.
 
Server String, read/write. The name of the EAS server.
 
UserDisplayName String, read/write. The display name of the EAS mailbox owner.
 
UserName String, read/write. The login user name of the EAS account.