How to add a delegate to an Exchange folder with the ACL component and CDO 1.21

Article translations Article translations
Article ID: 295558 - View products that this article applies to.
This article was previously published under Q295558
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all


You can use the Access Control List (ACL) component that ships with the Exchange Developer's Kit and CDO 1.21 to give a user delegate-like access to an Exchange folder. This is similar to using the Microsoft Outlook user interface to add a delegate.


To add users as delegates on an Exchange folder, you just need to grant them the proper permissions.

Note that using the Outlook user interface produces the following results, but that this method does not:
  • The delegate is listed in the Outlook user interface. To verify this, on the Tools menu, click Options, and then click the Delegates tab.

  • You can automatically send a message to new delegates, informing them of their permissions.

  • You can indicate that this delegate can view your private items.

Sample Code

NOTE: For information on the ACL component and how to acquire it, see the following Microsoft Developer Network (MSDN) Web site:
ACL Component
This sample gives UserA delegate-like access to UserB's Calendar folder. In this instance, UserA is given the role of Reviewer by using the ROLE_REVIEWER enumeration value. The other delegate roles are Author (ROLE_AUTHOR) and Editor (ROLE_EDITOR).

To add a delegate to an Exchange folder, follow these steps:
  1. In Microsoft Visual Basic version 6.0, create a Standard EXE project.
  2. Add a reference to the Microsoft Exchange 5.5 ACL Type Library version 1.0.
  3. Add a button to the default form. In the button's Click event, paste the following code:

    NOTE: Make sure that you modify the items that are marked "To do."
    ' To do: Change this to the user you want to give delegate access.
    Const UserA = "John Smith"
    ' To do: Change this to the user whose calendar you want to give UserA delegate access to.
    Const UserB = "Jane Smith"
    Dim oSession As MAPI.Session                    ' Session object
    Dim oCalendar As MAPI.Folder                    ' Folder object
    Dim oAddrBook As MAPI.AddressList               ' Address list
    Dim oDelegate As MAPI.AddressEntry              ' Address entry for UserA
    Dim oACLObject As MSExchangeACLLib.ACLObject    ' ACL object
    Dim oACEs As MSExchangeACLLib.IACEs             ' ACEs collection
    Dim oNewACE As MSExchangeACLLib.ACE             ' ACE object
    Dim strProfile As String                        ' String to hold profile information
    ' Create a new session and log on.
    Set oSession = CreateObject("MAPI.Session")
    ' To do: Change ServerName to the name of your Exchange server.
    strProfile = "ServerName" & vbLf & UserB
    oSession.Logon , , False, True, , True, strProfile
    ' Get the GAL so we can get the address entry for UserA.
    Set oAddrBook = oSession.AddressLists("Global Address List")
    ' Get the address entry for UserA.
    Set oDelegate = oAddrBook.AddressEntries.Item(UserA)
    ' Get the Calendar folder.
    Set oCalendar = oSession.GetDefaultFolder(CdoDefaultFolderCalendar)
    ' Create a new ACL Object.
    Set oACLObject = CreateObject("MSExchange.ACLObject")
    ' Link the ACL Object to the Calendar folder.
    oACLObject.CDOItem = oCalendar
    ' Get the ACEs collection for the Calendar.
    Set oACEs = oACLObject.ACEs
    ' Create a new ACE.
    Set oNewACE = CreateObject("MSExchange.ACE")
    ' Set the user for this ACE to UserA.
    oNewACE.ID = oDelegate.ID
    ' Set the rights to the "Reviewer" rights.
    oNewACE.Rights = ROLE_REVIEWER
    ' Add this ACE to the ACEs collection.
    oACEs.Add oNewACE
    ' Update the ACL Object.
    ' Log off
    ' Indicate the process is finished.
    MsgBox "Done!"
    ' Clean up memory.
    Set oNewACE = Nothing
    Set oACEs = Nothing
    Set oACLObject = Nothing
    Set oDelegate = Nothing
    Set oAddrBook = Nothing
    Set oCalendar = Nothing
    Set oSession = Nothing
  4. Run the project. Click the button to execute the code.


Article ID: 295558 - Last Review: February 28, 2014 - Revision: 4.4
  • Microsoft Exchange Server 5.5 Standard Edition
  • Microsoft Exchange 2000 Server Standard Edition
  • Microsoft Collaboration Data Objects 1.21
  • Microsoft Exchange Server 2003 Standard Edition
kbnosurvey kbarchive kbhowto kbmsg KB295558

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from