查询全局地址列表(GAL)为通过域用户 [英] Querying the Global Address List (GAL) for users across domains

查看:265
本文介绍了查询全局地址列表(GAL)为通过域用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要搜索包含在对Exchange服务器全局地址列表中的名称有一定的文本字符串的所有用户。此操作会从ASP.NET应用程序中进行。请注意,GAL是必须的(不是Active Directory),因为它包含了用户的跨域。这也是什么,客户提出要求。

I need to search for all users containing a certain text string in their name against the Exchange Server Global Address List. This operation will be performed from an ASP.NET application. Note that the GAL is required (not Active Directory) as it contains users across domains. It's also what the customer requested.

我一直在寻找的Exchange Web服务和Outlook Web Access的方法。但是可能都不在我的组织中配置,所以我需要了解哪些选项是正确的,要求基础设施来配置它。

I've been looking at Exchange Web Services and Outlook Web Access methods. However neither may be configured in my organisation so I need to know which option is the right one before asking infrastructure to configure it.

Exchange Web服务

我希望使用 ResolveNames 方法Exchange Web服务。它的文档指出:

I hoped to use the ResolveNames method in Exchange Web Services. The documentation for it states that:

Active Directory中最先被搜索,然后将用户的联系人文件夹中搜索。

Active Directory is searched first, and then the user's contact folder is searched.

这似乎暗示,这种方法只会从当前域回报用户。这是正确的?

It appears to imply that this method will only return users from the current domain. Is this correct?

的Outlook Web Access

我发现的另一种选择是GALFind。这看起来很完美,但这文章说,它是的不支持的。它被确认为在此的Technet 的文章不再可用。

The other option I found was GALFind. This looks perfect but this article stated that it is unsupported. It is confirmed as no longer available in this Technet article.

任何人都可以请这些或任何其他的选择给出建议?

Can anyone please give advice on these or any other options?

推荐答案

这是可能通过从林根查询跨域查询。这里是code我最终使用:

It is possible to query across domains by starting the query from the forest root. Here is the code I ended up using:

string filter = "(&(objectCategory=person)(objectClass=user)(name=*" + search + "*))";
var rootEntry = new DirectoryEntry("GC:");
foreach (DirectoryEntry entry in rootEntry.Children)
{
    DirectoryEntry forestEntry = entry;
    DirectorySearcher searcher = new DirectorySearcher
    	{
    		SearchRoot = forestEntry,
    		Filter = filter,
    		Sort =
    			{
    				Direction = SortDirection.Ascending,
    				PropertyName = "cn"
    			}
    	};
    searcher.PropertiesToLoad.AddRange(ADProperties.Values.ToArray());
    SearchResultCollection results = searcher.FindAll();
    foreach (SearchResult result in results)
    {
    	DirectoryEntry foundEntry = result.GetDirectoryEntry();

    	// Do something
    }
}

这篇关于查询全局地址列表(GAL)为通过域用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆