RDOAddressBook object

 

RDOAddressBook object provides address book related functionality: displaying the address book dialog, resolving names, accessing address lists and address entries, etc.

 

Returned by:

RDOSession.AddressBook

 


Derived from: _MAPIProp -


_MAPIProp methods and properties: GetIDsFromNames, Fields(), GetPropList, GetNamesFromIDs, CopyTo, Save, MAPIOBJECT, Session


Properties


AllRooms Returns RDOAddressList object representing the All Rooms container (Exchange only). Read-only. set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set ABDialog = Session.GetSelectNamesDialog
ABDialog.InitialAddressList = Session.AddressBook.AllRooms
ABDialog.AllowMultipleSelection = false
ABDialog.Caption = "Select a room"
ABDialog.ShowOnlyInitialAddressList = true
ABDialog.ForceResolution = true
set roomRecipients = ABDialog.Display(true)

DefaultAddressList

Returns or sets the default RDOAddressList object. Read-write.

 

Default address list is the default list shown when the Address Book dialog is displayed.

 

Setting this property to null (nothing in VB) will correspond to "Choose Automatically" in Outlook.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set AddrList = Session.AddressBook.AddressLists.Item("Contacts")

Session.AddressBook.DefaultAddressList = AddrList

 

GAL

Returns RDOAddressList object representing the Global Address List container (Exchange only). Read-only.

 

 

PAB

Returns RDOAddressList object designated as the Personal Address List. Read-only.

 

 

ResolveNameCheckOrder
rdoResolveNameCheckOrder, read/write.

Determines the order in which a name is resolved by the address book. Prior to multiple Exchange Server support, the order was always determined by RDOAddressbook.SearchPath list (see below). Starting with Outlook 2010,  the order can changed based on the currently selected store in Outlook.

rdoResolveNameCheckOrder:
coGAL = 1
coContactsFolder = 2
coCustom = 0 (determined by RDOAddressbook.SearchPath)
 

SearchPath

Returns RDOAddressBookSearchPath object which allows to manipulate the address book containers used in automatic name resolution.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set AddrList = Session.AddressBook.AddressLists.Item("Contacts")
Session.AddressBook.SearchPath.Remove(AddrList)

 


Methods


AddressLists(ShallowTraversal)

Returns RDOAddressLists object representing the top level address lists.

ShallowTraversal - boolean, optional; default value: false. If false, returns all address lists and their child lists in a single collection. If true, returns only the top level address lists, use AddressList.AddressLists collection to traverse the hierarchy.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set AddrList = Session.AddressBook.AddressLists(false).Item("Contacts")

MsgBox "There are " & AddrList.AddressEntries.Count & " items in the Contacts address list"

CreateOneOffEntryID(Name, AddressType, Address, SendRichInfo, UseUnicode)

Create a one-off entry id corresponding to the specified name, address type and address. Useful if you need to set the flag (MAPI_ONE_OFF_NO_RICH_INFO) governing whether a message will be sent in the RTF format or not.

Name - string, name of the recipient

AddressType - string, address type

Address  - string, e-mail address

SendRichInfo - boolean. If true, e-mails will be sent in the RTF format

UseUnicode - boolean. Determines whether the name and address are embedded in the Unicode format. Note that Outlook 2000 cannot handle one-off entry ids in the Unicode format.

 

'for a given contact (ContactItem Outlook object), turn RTF off for Email1Address

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set RDOContact = Session.GetMessageFromID(ContactItem.EntryID)
'make sure RTF is off for the contact
'only works for the SMTP addresses

if RDOContact.Email1AddressType = "SMTP" Then
  RDOContact.Email1EntryID = Session.AddressBook.CreateOneOffEntryID(_

                                             RDOContact.Email1DisplayName, _

                                             "SMTP", _

                                             RDOContact.Email1Address, _

                                             false, true)
  RDOContact.Save
End If

 

GetAddressEntryFromID(EntryID)

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

Returns RDOAddressEntry object.

 

 

GetAddressEntryFromStoreItem(ContactOrDistList, AddressType)

Returns the RDOAddressEntry object from an RDOContactItem or RDODistListItem objects. This is the counterpart of the GetContact and GetDistList methods implemented by the RDOAddressEntry object

ContactOrDistList - RDOContactItem or RDODistListItem object.

AddressType -  variant, optional. One of the rdoAddressType enums. If not specified, defaults to atEmail1.

atEmail1 = 0
atEmail2 =1
atEmail3 = 2
atBusinessFax =3
atHomeFax = 4
atOtherFax = 5
 

GetAddressListFromID(EntryID)

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

Returns RDOAddressList object.

 

 

ShowAddressBook(Recipients, Title, OneAddress, ForceResolution, RecipLists,
ToLabel, CcLabel, BccLabel, ParentWindow
)

 

Displays the Address Book window modally and returns the selected recipients as the RDORecipients collection object.

Recipients - RDORecipients object, optional. Initial recipients displayed by the Address Book dialog.

Title - string, optional. the title of the Address Book dialog.

OneAddress - boolean, optional. If true, allows only one address to be selected.

ForceResolution - boolean, optional. If true, force all returned recipients to be resolved.

RecipLists - integer, optional. Number of wells in the address book dialog (3 by default - To, CC, BCC)
ToLabel - string, optional. "To" label.

CcLabel  - string, optional. "CC" label.

BccLabel  - string, optional. "BCC" label.

ParentWindow - integer, optional. Handle to the parent window. If none is specified, the foreground window will be used as a parent

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Inbox = Session.GetDefaultFolder(olFolderInbox)
set Msg = Inbox.Items.Add
Msg.CC = "dmitry@dimastr.com; outspy@dimastr.com"
Msg.Recipients.ResolveAll
Msg.Subject = "test"
set AB = Session.AddressBook
set Recips = AB.ShowAddressBook(Msg.Recipients)
Msg.Recipients = Recips
Msg.Save

 

ResolveName(Name, ShowDialog, ParentWnd)

Resolves the given name in the address book and returns it as an RDOAddressEntry object.

 

Name - string. The name to be resolved.

ShowDialog - boolean, optional. If true, the address book dialog will displayed if the name cannot be resolved or if the name is ambiguous.

ParentWnd - integer, optional. The handle of the window to be used as the dialog parent.

See also: AddressList.ResolveName

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set AdrrEntry = Session.AddressBook.ResolveName("dmitry")

MsgBox "The address of the name is " & AddrEntry.Address

ResolveNameEx(Name)

Resolves the given name in the address book and returns a list of matches in the RDOAddressEntries object.

 

ResolveNameEx goes through all containers in the search path (see the SearchPath property) and resolves the given name against each address list (see RDOAddressList.ResolveNameEx) in the search path. As soon as a non-empty list is returned, the method returns. It does not combine matches from all address containers in the search path.

 

Name - string. The name to be resolved.

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set AdrrEntries = Session.AddressBook.ResolveNameEx("John")
Debug.Print AdrrEntries.Count & " names were returned by ResolveNameEx:"
Debug.Print "------------"
for each AE in AdrrEntries
    Debug.Print AE.Name
next
Debug.Print "------------"