RDODistListItem object

 

RDODistListItem object represents an "IPM.DistList" message in one of Outlook's contacts folders. RDODistListItem is derived from the RDOMail object and as such inherits all the properties, methods and events implemented by the RDOMail object and adds the following methods and properties

 

Everywhere RDOMail object is normally returned (RDOSession.GetMessageFromID, RDOFolder.Items, etc), RDODistListItem will be returned if the message class is "IPM.DistList".

 

The example below creates a new distribution list item in the default Contacts folder and adds a member to it.

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Contacts = Session.GetDefaultFolder(olFolderContacts)
set DL = Contacts.Items.Add("IPM.DistList")
DL.DLName = "Redemption test"
DL.AddMember("test <test@dimastr.com>")
DL.Save

 

Properties

Methods

 


Derived from: RDOMail


Properties


CheckSum

integer, internal use only. CheckSum property represents the checksum unique to the given list of the DL members.

 

 

DLName

Returns or sets a String representing the display name of a distribution list. Read/write.

 

see the example at the top of this page

MemberCount

Returns an integer indicating the number of members in a distribution list. Read-only.

 

 

Members

Returns an RDOAddressEntries object representing the members of the distribution list.

Distribution lists store members in two collections: Members, which contains the original entry ids,  and OneOffMembers, which contains the one-off entry ids. One-off entry ids are self contained, i.e. they embed both the name and address of the address entry. If a member points to a contact that was deleted, it would be impossible to retrieve the member, while the one-off entry id will still be valid since it does not depend on any external MAPI objects.

GetMember method (see below) checks if the member entry id is still valid. If not, it returns an RDOAddressEntry object corresponding to the one-off entry id.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Contacts = Session.GetDefaultFolder(olFolderContacts)
set DL = Contacts.Items("test dl")
for each Member in DL.Members
  Debug.Print Member.Name & ": " & Member.Address
next

OneOffMembers

Returns an RDOAddressEntries object representing the members of the distribution list.

See comment for the Members property above.

 


Methods


AddContact(ContactItem, AddressType)

Adds a Contact or a Distribution List as a member of the distribution list.

ContactItem - an object representing IPM.Contact or IPM.DistList message, such as RDOContactItem, RDODistList, RDOMail, Outlook.MailItem, etc object. The only requirement is that the object must expose a MAPIOBJECT property which returns an IMessage Extended MAPI object.
AddressType - one of the rdoAddressType enums that specify which contact address (Email1, Emal2, Fax1, etc) must be added.

This parameter is ignored if a Distribution List is being added.

 

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

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Contacts = Session.GetDefaultFolder(olFolderContacts)

'retrieve an existing distribution list
set DL = Contacts.Items("test dl")

'retrieve an existing contact's Email3 address to the DL
set Contact = Contacts.Items("Dmitry Streblechenko")
'add the contact to thee distribution list and save it
DL.AddContact(Contact, atEmail3)
DL.Save

AddMemberEx(Name, Address, AddressType)

Allows to add a one-off address to the distribution list

Name - string, the name of the member

Address- string, the address of the member

AddressType- string, the address type of the member, e.g. "SMTP"

 

DistListItem.AddMemberEx("Dmitry", "test@dimastr.com", "SMTP")

AddMember(RecipientOrAddressentryOrName)

Adds a given object as a member of the distribution list.

RecipientOrAddressentryOrName - RDORecipient, RDOAddressEntry or a string representing the new member. If the value is a string, it will be resolved to an address entry using the standard name resolution.

 

see the example at the top of this page

AddMembers(Recipients)

Adds all of the recipients to the distribution list.

Recipients - RDORecipients object, most often returned by the RDOMail.Recipients property

 

 

GetMember(Index)

Returns an RDOAddressEntry object representing the member with the given index. This method checks if the member entry id is still valid and returns an entry from the Members collection. If not, it returns an RDOAddressEntry object corresponding to the one-off entry id from the OneOffMembers collection. See Members property help above.

Index - integer, 1 through MemberCount.

 

 

RemoveMember(Index)

Removes the distribution list member with the given index.

Index - integer, 1 through MemberCount.

 

 
UpdateMembers(DeleteIfNotFound, SearchIfNotFound, DisplayPrompts, ParentWindowHandle)
Updates the members of the distribution list and returns the number of modified members. If no members were modified, 0 is returned.
For the changed members, name and address is updated.
Deleted members will be deleted from the distribution list if the DeleteIfNotFound parameter is true.
If a member cannot be found, and SearchIfNotFound  parameter is true, UpdateMembers will search for a matching contact (based on the e-mail address) in the parent folder of the distribution list. If the DL comes from an MSG file, the search will be performed in the default Contacts folder.

DeleteIfNotFound - Variant, optional. If not specified, defaults to true.
If true, the members that cannot be opened will be deleted.

SearchIfNotFound - Variant, optional. If not specified, defaults to true.
If true and a member cannot be found,  UpdateMembers will search for a matching contact (based on the e-mail address) in the parent folder of the distribution list. If the DL comes from an MSG file, the search will be performed in the default Contacts folder.

DisplayPrompts - Variant, optional. If not specified, defaults to true.
If true, UpdateMembers will ask the user if the member should be removed:
Could not find contact "%s". It may have been deleted or moved from its original location. Would you like to remove it from the list?

ParentWindowHandle - Variant, optional. If not specified, defaults to the handle of the foreground window.
The handle of the window to be used as the parent for the prompt (see DisplayPrompts parameter). An HWND or an Outlook Explorer or Inspector object can be passed as a parameter.
'Open the currently selected distribution list and update its members
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set DL = Session.GetMessageFromID(Application.ActiveExplorer.Selection(1).EntryID)
If DL.UpdateMembers(true, true, true, Application.ActiveExplorer) > 0 Then
   
DL.Save
End If