Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / Exchange Server / Applications / June 2006

Tip: Looking for answers? Try searching our database.

Problem with LDAP query to resolve Email-address in C# app.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alessandro.rolla@gmail.com - 30 May 2006 08:19 GMT
Hello,
i try to create a function with a behavior like the Outlook or OWA
Ctrl-K.

My Organization have a primary domain controller and 5 child domain.

We have and Exchange Server on the primary domain e 5 child exchange
server in the 5 child domain.

I log in my primary domain controller with domain admin privilege.

I create a c# code like this:

DirectoryEntry entry = new
DirectoryEntry("LDAP://MyEchange.MyDomain.Com");
DirectorySearcher searcher = new DirectorySearcher(entry);
searcher.SearchScope=SearchScope.Subtree.
searcher.filter="(& (mailnickname=*) (|
(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategory=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributionList)
))";

I retrieve the query for the filter from the purportedSearch in the
Default Global Address List with ADSI edit.

My Problem is that the  addresses i retrieve with this query is not the
same of the Exchange System Manager preview on the Default Global
Address List.

In the Exchange System Manager i retrieve(obviously) all the addresses
of my organization with all child domain addresses.

With my query i have only the addresses and contact(and public folder)
about the addresses in the primary domain controller but i can't
retrieve the child domain addresses.

If i copy my query on a custom query in Active Directory Users and
Computer in the same server (MyExchange.MyDomain.Com) I retrieve the
addresses of my query and not the same of the Exchange System Manager.

I think is an Entry Point Problem?

Can anyone help me please?

Thank,Alessandro.
Henning Krause [MVP - Exchange] - 30 May 2006 12:19 GMT
Hello,

using a query based on the purportedSearch is not a good thing (see
http://www.infinitec.de/articles/exchange/getgal.aspx).

Another thing is, that you must do a search on the global catalog to get all
addresses.

From within a the domain, do a bind on GC:

Then enumerate the childs of that object and take the first one. This object
can be used as searchroot to search the entire forest.

Best regards,
Henning Krause

> Hello,
> i try to create a function with a behavior like the Outlook or OWA
[quoted text clipped - 40 lines]
>
> Thank,Alessandro.
alessandro.rolla@gmail.com - 30 May 2006 14:57 GMT
It is possibile to recreate the OWA Ctrl-K function to resolve the
name?

There is a LDAP  query based on the Ctrl_k function?Or OWA use MAPI?

I have some WEBDAV function but my problem is that i don't have a good
skill on Active Directory adn LDAP in general and i don't find a
comprensible documentation on how to search an object based on a
dinamic query...i have some problem to reorganize my query in a
SQL-synthax in which i have a SELECT part a FROM and a WHERE.
Thanks a lot for your reply.
Ale.
Henning Krause [MVP - Exchange] - 30 May 2006 16:00 GMT
Hello,

when searching Active Directory you don't use an SQL like syntax.

If you want to resolve a surname to an email based on the GAL, you could do
search of (&(sn=<name>)(showInAddressBook=<dn of gal>))
To do a search on the first name, the query would be:
(&(givenName=<name>)(showInAddressBook=<dn of gal>))

For both options:
(&(|(sn=<name>)(givenName=<name>))(showInAddressBook=<dn of gal>))

And do this search over the first childobject of the GC: directory entry.

You can even do a wildcard search if <name> is something like Foo*.

Best regards,
Henning Krause

> It is possibile to recreate the OWA Ctrl-K function to resolve the
> name?
[quoted text clipped - 8 lines]
> Thanks a lot for your reply.
> Ale.
Karim Batthish [MS] - 02 Jun 2006 19:21 GMT
Another option to consider is using the Active Directory "anr" search
parameter, like:

  (&(anr=[user string])(mail=*))

to do a "Check names"-like query.

Cheers,
- Karim

> Hello,
>
[quoted text clipped - 27 lines]
>> Thanks a lot for your reply.
>> Ale.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.