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


AddLDAPAccount(
      Name,
      ServerName,
      Port,
      UserName,
      Password,
      SearchTimeout,
      MaxEntries,
      UseSSL,
      RequireSPA,
      EnableBrowsing,
      CustomSearchBase
)
Adds a new LDAP account and returns an instance of the RDOLDAPAccount object.

Name - the name of the LDAP account to be added.

ServerName - the name or IP address of the LDAP server

Port - LDAP server port, integer, optional. If not specified, defaults to 389,.

UserName - optional, string. The user name to be used when authenticating against the LDAP server.

Password - optional, string. The password to be used when authenticating against the LDAP server.

SearchTimeout - optional, integer. Search timeout, in seconds. If not specified, defaults to 60.

MaxEntries - optional, integer. Maximum number of search entries to return If not specified, defaults to 100.

UseSSL - optional, boolean. True if SSL connection is to be used. If not specified, defaults to false;

RequireSPA  - optional, boolean. True if SPAconnection is to be used. If not specified, defaults to false;

EnableBrowsing - optional, boolean. True if the address book window will display the entries without a search. Requires server support. If not specified, defaults to false;

CustomSearchBase - optional, string. Specifies the custom base for the LDAP queries.

set Session = CreateObject("Redemption.RDOSession")

Session.MAPIOBJECT = Application.Session.MAPIOBJECT

set Accounts = Session.Accounts

set LdapAccount = Accounts.AddLDAPAccount("Test LDAP Account", _

                    "www.zflexldap.com", 389, _

                    "cn=ro_admin,ou=sysadmins,dc=zflexsoftware,dc=com", _

                    "zflexpass")


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

 

RefreshFromMAPI
Since there are two kinds of accounts in Outlook - MAPI based (such as Exchange MSEMS) and non-MAPI (such as POP3/SMTP), Outlook (through the IOlkAccountManager interface) keeps the two lists in sync. Some MAPI accounts added directly through Redemption (e.g. by calling RDOStores.AddDelegateExchangeMailBoxStore) might not become immediately visible to Outlook. RDOAccounts.RefreshFromMAPI method forces Outlook to sync the two lists internally without restarting the application.

 

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.