RDOAccounts object

 

RDOAccounts collection represents the mail, store and address book accounts configured in the current profile.

This collection is only available if Outlook 2002 or higher is installed.

 

Returned by:

RDOSession.Accounts

 

The example below prints out the names of all accounts in the current profile

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

 

Properties

Methods

Events

 


Derived from: IDispatch


Properties


Count

Returns the number of account in the given profile. Integer, read-only.

 

Session

Returns the parent RDOSession object. Read-only.

 

Methods


AddPOP3Account (
                Name,
                Address,
                POP3Server,
                SMTPServer,
                UserName,
                Password
)

Adds a new POP3/SMTP account and returns an instance of the RDOPOP3Account object.

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Accounts = Session.Accounts
set POP3Account = Accounts.AddPOP3Account("Joe The User", _           
                                          "address@domain.demo", _
                                          "Pop3server.domain.demo", _
                                          "SmtpServer.domain.demo", _
                                          "LogonUserName@domain.demo", _
                                          "ThePassword!")
POP3Account.SMTP_UseAuth = true
POP3Account.SMTP_LogonKind = 0 'rdoSMTPLogonKind.lkSameAsIncoming
POP3Account.SMTP_Port = 1025
POP3Account.LeaveMessagesOnServer = true
POP3Account.DeleteFromServerAfterXDays = true
POP3Account.DaysBeforeDelete = 14
POP3Account.Save
 

DisplayAccountList(

                ParentWnd,

                ActiveTab)

 

Displays the Account Settings dialog (accessible in Outlook through Tools | Account Settings...).

 

ParentWnd - optional, the handle (HWND) of the window to be used as the dialog's parent. If not specified, the foreground (topmost) window is used.

 

ActiveTab - optional, specifies the active tab when the dialog is displayed. Currently, only E-mail and Data tabs can be preselected.

If not specified, altEmail (0) is used.

 

rdoAccountListTab:

altEmail (0)

altStores (1)

 

 

DisplayNewAccountWizard(

                ParentWnd)

 

Displays the "Add New E-mail Account" dialog.

 

ParentWnd - optional, the handle (HWND) of the window to be used as the dialog's parent. If not specified, the foreground (topmost) window is used.

 

 

Item(Index)

Returns an account (RDOAccount object) corresponding to the given index.

 

Index - variant. Either an integer index (1 through Count) or a string representing either the account name, stamp or send stamp.

 

Note: the actual type of the returned object depends on the particular account. 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 - LDAP accounts

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Accounts = Session.Accounts
for i = 1 to Accounts.Count
  set Account = Accounts.Item(i)
  Debug.Print Account.Name
next

 

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

MsgBox "Account type is: " & Account.AccountTypeStr

GetOrder(AccountCategory)

Returns a list (RDOAccountOrderList object) representing the order of the account of a particular kind given by the AccountCategory parameter.

AccountCategory - one of the rdoAccountCategory enumeration values:

acStore (1)
acMail (2)
acAddressBook (4)

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Accounts = Session.Accounts
'all mail accounts
Debug.Print "Mail Accounts:"
set List = Accounts.GetOrder(2)
for each Account in List
  Debug.Print Account.Name
next

 

Remove(Index)

Deletes the account corresponding to the given index.

Index - variant. Either an integer index (1 through Count) or a string representing either the account name, stamp or send stamp.

 

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

 


Events:


AccountChange(Account)

Fires when an account is modified.

Account - RDOAccount object

Dim WithEvents Accounts As Redemption.RDOAccounts
...

set Session = New Redemption.RDOSession
Session.Logon
Set Accounts = Session.Accounts
...

Sub Accounts_AccountChange(ByVal Account As RDOAccount)
  MsgBox "Account modified: " & Account.Name
End Sub

 

AccountAdd(Account)

Fires when a new Outlook account is added.

Account - RDOAccount object

 

 

AccountRemove(AccountID)

Fires when an account is removed. Since the accoun is already removed when this event fires, only the Account ID is available

AccountID - integer, the ID of the Account

 

 

AccountBeforeRemove(Account)

Fires before an account is removed.

Account - RDOAccount object

 

 

AccountOrderChange

Fires when the accounts order is changed.