从C#访问Outlook中的代理访问人员列表

时间:2015-11-19 13:06:47

标签: c# vsto outlook-addin

我想在Outlook 2013中列出所有具有委派访问权限的人。我需要在Visual Studio 2013中创建的Outlook AddIn中使用它。是否可以列出这些人员?

1 个答案:

答案 0 :(得分:1)

使用Namespace.AutodisoverXml属性 - 它将列出委托邮箱。您可以在OutlookSpy中看到自动发现XML - 单击“命名空间”按钮,选择“AutodisoverXml”属性。

           ...
           <AlternativeMailbox>
                <Type>Delegate</Type>
                <DisplayName>Test user</DisplayName>
                <SmtpAddress>user@domain.com</SmtpAddress>
                <OwnerSmtpAddress>user@domain.com</OwnerSmtpAddress>
            </AlternativeMailbox>

如果使用Redemption是一个选项,您可以检索委托列表以及后退列表(将给定用户作为委托的用户):

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