从全局地址列表 (EWS) 内的 PublicGroup 获取 GroupContact 成员

发布于 2024-10-03 21:31:27 字数 339 浏览 0 评论 0原文

将电子邮件发送到通讯组列表时,可以在全局地址列表 (GAL) 中找到这些列表本身。在 Outlook 2010 中访问 GAL 非常简单,只需弹出地址簿并选择适当的地址簿(在本例中为登录用户的 GAL)。

我已经尝试过多次尝试访问 GAL 中的 ContactGroup 的成员,但它似乎没有 ID(因此也没有 UniqueID)。它从已发送电子邮件的 ToRecipients 属性中以 MailboxType.PublicGroup 的 MailboxType 形式出现,但我不知道如何访问实际的联系地址!

有人知道我怎样才能抓住他们吗?我尝试过进行公共文件夹搜索,搜索完整的联系人,但似乎没有找到它。

丹尼尔.

When sending emails to distribution lists, the lists themselves are found within the Global Address List (GAL). Accessing the GAL within Outlook 2010 is a simple matter of popping into your address book and selecting the appropriate address book (in this case, the GAL for the logged in user).

I've tried and tried to get access to the Members of a ContactGroup within the GAL but it doesn't appear to have an ID (and as such, no UniqueID either). It comes up as a MailboxType of MailboxType.PublicGroup from within the ToRecipients property of a sent email, but I can't find out how to access the actual contact addresses!

Anyone know how I can get a hold of them? I've tried doing public folder searches, full Contacts searched but nothing seems to find it.

Daniel.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乱了心跳 2024-10-10 21:31:27

我使用 Exchange Web Services Managed API 1.1 SDK,它的工作方式非常出色。
替换为您自己的。

using System;
using System.Windows.Forms;
using Microsoft.Exchange.WebServices.Data;

namespace test3
{
    public partial class Form1 : Form
    {
        ExchangeService service = null;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            service = new ExchangeService();
            service.Url = new Uri("https://<exchange_server>/EWS/Exchange.asmx");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            NameResolutionCollection nameResolutions = service.ResolveName(
                "<group_name>",
                ResolveNameSearchLocation.DirectoryOnly,
                true);

            foreach (NameResolution nameResolution in nameResolutions)
            {
                ExpandGroupResults groupResults = service.ExpandGroup(nameResolution.Mailbox.Address);
                foreach (EmailAddress member in groupResults.Members)
                {
                    Console.WriteLine(member.Name + " <" + member.Address + ">");
                }
            }
        }
    }
}

I use Exchange Web Services Managed API 1.1 SDK and it works like a charm.
Replace <exchange_server> and <group_name> with your own one.

using System;
using System.Windows.Forms;
using Microsoft.Exchange.WebServices.Data;

namespace test3
{
    public partial class Form1 : Form
    {
        ExchangeService service = null;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            service = new ExchangeService();
            service.Url = new Uri("https://<exchange_server>/EWS/Exchange.asmx");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            NameResolutionCollection nameResolutions = service.ResolveName(
                "<group_name>",
                ResolveNameSearchLocation.DirectoryOnly,
                true);

            foreach (NameResolution nameResolution in nameResolutions)
            {
                ExpandGroupResults groupResults = service.ExpandGroup(nameResolution.Mailbox.Address);
                foreach (EmailAddress member in groupResults.Members)
                {
                    Console.WriteLine(member.Name + " <" + member.Address + ">");
                }
            }
        }
    }
}
半衬遮猫 2024-10-10 21:31:27

EWS 不是适合这项工作的工具。您需要查询 ActiveDirectory。请参阅http://www.infinitec.de/post/2005/02/How-to-get-the-Global-Address-List-programatically.aspx 为例。

EWS is not the right tool for the job. You need to query ActiveDirectory. See http://www.infinitec.de/post/2005/02/How-to-get-the-Global-Address-List-programatically.aspx for an example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文