INFO: Comparing Use of ADSI and CDO to Access CDOEXM Recipient-Related Methods (297390)



The information in this article applies to:

  • Microsoft Windows 2000 Advanced Server SP1
  • Microsoft Exchange 2000 Server
  • Microsoft Exchange 2000 Enterprise Server
  • Microsoft Active Directory Services Interface, System Component
  • Microsoft Collaboration Data Objects for Exchange Management (CDOEXM)
  • Collaboration Data Objects for Exchange 2000

This article was previously published under Q297390

SUMMARY

This article describes the advantages and disadvantages of the use of Active Directory Service Interfaces (ADSI) objects versus the use of Collaboration Data Objects (CDO) to query for the CDO for Exchange Management (CDOEXM) interfaces IMailboxStore, IMailRecipient, and IDistributionList for Active Directory and Exchange objects.

MORE INFORMATION

The CDOEXM library is a set of interfaces that expose properties and methods that enable the user to perform several Exchange recipient-related and Exchange Server-related tasks. For more information about what tasks you can perform, see the following MSDN Web page: The interfaces in the CDOEXM library that expose recipient-related properties and methods are the following:
  • IMailRecipient
  • IMailboxStore
  • IDistributionList
These recipient-management interfaces are aggregated into the CDO.Person(IPerson), CDO.Folder(IFolder), ADSI Contact(IADs), ADSI User(IADsUser), and ADSI Group(IADsGroup) objects. This means that the IMailRecipient, IMailboxStore, and DistributionList interfaces are exposed by these objects and therefore can only be derived from interfaces that are exposed on these objects.

For example, to use a method on the IMailRecipient interface against an Active Directory user, first either an ADSI IADsUser or CDO.Person object must be created and bound to that user. Once this is accomplished, the IMailRecipient interface can be queried for on this object. The CDOEXM recipient management interfaces cannot be directly used to bind to an object.

NOTE: CDOEXM.dll is installed when you install the Exchange 2000 Management Tools.

Based on the tasks that you intend to perform through the use of the CDOEXM recipient-management interfaces and based on your familiarity with CDO or ADSI, you may decide which to use with CDOEXM. The following comparison may help you decide which to use.

Using ADSI Interfaces to Derive CDOEXM Interfaces

Advantages of Using ADSI

  • Minimum software requirement: An application that uses ADSI and CDOEXM recipient-management interfaces does not have to be run on an Exchange 2000 Server. This differs from using CDO, which requires that the program be run on an Exchange 2000 Server. CDOEXM does require that the code be run on a Windows 2000 Server or Windows 2000 Advanced Server-based system that has the Exchange 2000 Management Tools installed.

    NOTE: An attempt to copy Cdoexm.dll and register this file through the use of Regsvr32 may not work properly. The only acceptable configuration in which to use any of the three CDOEXM recipient-management interfaces is to have Exchange 2000 Management Tools installed on a Windows 2000 Server-based or Windows 2000 Advanced Server-based computer.
  • Managing groups: Groups can be managed only through the use of ADSI. IADsGroup and IADs interfaces can be used to interact with Active Directory group objects. The CDOEXM.IDistributionList and CDOEXM.IMailRecipient interfaces can be derived from these interfaces.

Disadvantages of Using ADSI

  • Mail properties: Manipulation of mail-related properties on public folders requires the use of the CDOEXM.IMailRecipient interface, but this interface cannot be derived from any of the ADSI objects. To manipulate these proprieties, you can instead use CDO, as explained later in this article.

Using CDO Interfaces to Derive CDOEXM Interfaces

Advantages of Using CDO

  • Mail properties: CDO provides the ability to manipulate mail-related properties on public folders. To access these properties, you can use the CDO.IFolder interface to bind to the folder and then query for the CDOEXM.IMailRecipient interface.

Disadvantages of Using CDO

  • Minimum software requirement: Code that uses CDO and CDOEXM recipient-management interfaces must be run on an Exchange 2000 Server. This is because the CDO interfaces (Cdoex.dll) are installed as part of Exchange 2000 Server.

    WARNING: Microsoft does not support manual copying and registration of Cdoex.dll because this can lead to compatibility problems.
  • Managing Groups: The CDO interfaces cannot be used to manage Active Directory group objects. To accomplish this you can use ADSI, as explained earlier in this article.

REFERENCES

Recipient Management Interfaces
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_cdo_recipient_management_interfaces.asp

IADs
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/adsi/iads.asp

IADsUser
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/adsi/iadsuser.asp

IADsGroup
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/adsi/iadsgroup.asp

IPerson Interface
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_cdo_iperson_interface.asp

IFolder Interface
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_cdo_ifolder_interface.asp

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:

293339 HOWTO: Create a Mail-Enabled User with CDOEXM in Visual C++

297398 HOWTO: Delete a Mailbox Using CDOEXM and Visual C++

297393 HOWTO: Programmatically Move an Exchange 2000 Mailbox Using CDOEXM in Visual C++


Modification Type:MinorLast Reviewed:8/18/2005
Keywords:kbDSWADSI2003Swept kbArtTypeINF kbinfo KB297390 kbAudDeveloper