'Access list of delegate access persons in Outlook from C#

I want to list all persons who has delegate access in Outlook 2013. I need it in an Outlook AddIn created in Visual Studio 2013. Is it possible to list these persons?



Solution 1:[1]

Use Namespace.AutodisoverXml property - it will list the delegate mailboxes. You can see the autodiscover XML in OutlookSpy (I am its author) - click the Namespace button, select the AutodisoverXml property.

           ...
           <AlternativeMailbox>
                <Type>Delegate</Type>
                <DisplayName>Test user</DisplayName>
                <SmtpAddress>[email protected]</SmtpAddress>
                <OwnerSmtpAddress>[email protected]</OwnerSmtpAddress>
            </AlternativeMailbox>

If using Redemption (I am its author) is an option, you can retrieve the delegate list as well as the back list (users who have the given user as a delegate):

set Session = CreateObject("Redemption.RDOSession")
  Session.MAPIOBJECT = Application.Session.MAPIOBJECT
  set AddressEntry = Session.CurrentUser
  Debug.Print "-- Delegates (who can send of behalf of "  & AddressEntry.Name & ")"
  for each AE in AddressEntry.Delegates
    Debug.Print AE.Name
  next
  Debug.Print "-- Is delegate for (can send on behalf of these users)"
  for each AE in AddressEntry.IsDelegateFor
    Debug.Print AE.Name
  next
  Debug.Print "-- Is member of the following Dist Lists:"
  for each AE in AddressEntry.IsMemberOfDL
    Debug.Print AE.Name
  next
  Debug.Print "-- The following users report to " & AddressEntry.Name
  for each AE in AddressEntry.Reports
    Debug.Print AE.Name
  next

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1