C# Microsoft.Office.Interop.Outlook 获取通讯组的所有者
C# Microsoft.Office.Interop.Outlook Getting Owner of Distribution Group
我正在尝试获取用户在 Outlook 中拥有的通讯组列表。我看到了如何获取用户所属的组(见下文),但找不到任何关于所有权的信息。我知道这可以使用 Active Directory,但希望能够改用 Microsoft.Office.Interop.Outlook 库。我希望能够让用户 select 拥有列表 he/she 中的一个组,并修改成员。
private void GetCurrentUserMembership()
{
var appOutlook = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.AddressEntry currentUser = appOutlook.Session.CurrentUser.AddressEntry;
if (currentUser.Type == "EX")
{
Microsoft.Office.Interop.Outlook.ExchangeUser exchUser = currentUser.GetExchangeUser();
if (exchUser != null)
{
Microsoft.Office.Interop.Outlook.AddressEntries addrEntries = exchUser.GetMemberOfList();
if (addrEntries != null)
{
foreach (Microsoft.Office.Interop.Outlook.AddressEntry addrEntry in addrEntries)
{
Debug.WriteLine(addrEntry.Name);
}
}
}
}
}
我没有用 DL 尝试过,但尝试使用 AddressEntry.PropertyAccessor.GetProperty
检索 PR_EMS_AB_ASSOC_NT_ACCOUNT
(DASL 名称 http://schemas.microsoft.com/mapi/proptag/0x80270102
)。然后您可以尝试使用 SID 来查找用户。
我正在尝试获取用户在 Outlook 中拥有的通讯组列表。我看到了如何获取用户所属的组(见下文),但找不到任何关于所有权的信息。我知道这可以使用 Active Directory,但希望能够改用 Microsoft.Office.Interop.Outlook 库。我希望能够让用户 select 拥有列表 he/she 中的一个组,并修改成员。
private void GetCurrentUserMembership()
{
var appOutlook = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.AddressEntry currentUser = appOutlook.Session.CurrentUser.AddressEntry;
if (currentUser.Type == "EX")
{
Microsoft.Office.Interop.Outlook.ExchangeUser exchUser = currentUser.GetExchangeUser();
if (exchUser != null)
{
Microsoft.Office.Interop.Outlook.AddressEntries addrEntries = exchUser.GetMemberOfList();
if (addrEntries != null)
{
foreach (Microsoft.Office.Interop.Outlook.AddressEntry addrEntry in addrEntries)
{
Debug.WriteLine(addrEntry.Name);
}
}
}
}
}
我没有用 DL 尝试过,但尝试使用 AddressEntry.PropertyAccessor.GetProperty
检索 PR_EMS_AB_ASSOC_NT_ACCOUNT
(DASL 名称 http://schemas.microsoft.com/mapi/proptag/0x80270102
)。然后您可以尝试使用 SID 来查找用户。