Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
date: Thu, 8 Jun 2006 08:36:02 -0700,    group: microsoft.public.exchange2000.development        back       


Get all users from the Global Address List (GAL)   
I have been looking for a way to get the list of all users on my exchange 
server from some C# code running over a network. 

It would be nice to be able to do it using WebDAV as all my other code uses 
that but if there is another way then i'll consider it. 

Thanks in Advance

Matt.
date: Thu, 8 Jun 2006 08:36:02 -0700   author:   MPH

Re: Get all users from the Global Address List (GAL)   
The absolute fastest mechanism would be to use LDAP calls against Active 
Directory. Anything that goes through the Exchange interfaces slows down 
significantly and all translate back to AD calls anyway.

--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net


---O'Reilly Active Directory Third Edition now available---

         http://www.joeware.net/win/ad3e.htm



MPH wrote:
> I have been looking for a way to get the list of all users on my exchange 
> server from some C# code running over a network. 
> 
> It would be nice to be able to do it using WebDAV as all my other code uses 
> that but if there is another way then i'll consider it. 
> 
> Thanks in Advance
> 
> Matt.
date: Thu, 08 Jun 2006 15:10:15 -0400   author:   Joe Richards [MVP]

Re: Get all users from the Global Address List (GAL)   
Hello,

see http://www.infinitec.de/articles/exchange/getgal.aspx.

Best regards,
Henning Krause

"MPH"  wrote in message 
news:333BFD7B-BF44-4991-A33E-FA252E53C538@microsoft.com...
>I have been looking for a way to get the list of all users on my exchange
> server from some C# code running over a network.
>
> It would be nice to be able to do it using WebDAV as all my other code 
> uses
> that but if there is another way then i'll consider it.
>
> Thanks in Advance
>
> Matt.
date: Thu, 8 Jun 2006 21:14:34 +0200   author:   Henning Krause [MVP - Exchange]

Re: Get all users from the Global Address List (GAL)   
Cheers for the help, I looked around for something similar to what you 
suggested in C# and got something working that gets the user from my Domain. 

below is my code, I was wondering how I can get user accounts without 
getting system default user accounts too. 

---------------------------------------
System.DirectoryServices.DirectoryEntry oDirEntry = new  
DirectoryEntry("LDAP://serveraddress/DC=toffaexchange,DC=local", "username", 
"password");

DirectorySearcher oSrch = new DirectorySearcher(oDirEntry);

oSrch.Filter = "(&(objectClass=user)(objectCategory=user)(mail=*))";
oSrch.SearchScope = SearchScope.Subtree;

oSrch.PropertiesToLoad.Add("givenName");
oSrch.PropertiesToLoad.Add("sn");
oSrch.PropertiesToLoad.Add("mail");

SearchResultCollection results = oSrch.FindAll();


 foreach (SearchResult oRes in results)
{
      string s1 = null;
      string s2 = null;
      string s3 = null;

      ResultPropertyValueCollection myMail = oRes.Properties["mail"];
      if (myMail.Count != 0)
                {
                    s1 = myMail[0].ToString();
                }

       ResultPropertyValueCollection myFirstName =                   
oRes.Properties["givenName"];

        if (myFirstName.Count != 0)
                {
                    s2 = myFirstName[0].ToString();
                }

      ResultPropertyValueCollection mySecondName = oRes.Properties["sn"];
                
       if (mySecondName.Count != 0)
                {
                    s3 = mySecondName[0].ToString();
                }
            

            Console.WriteLine("Email: " +
            s1 + " Name: " +
            s2 + " " +
            s3);
            }
------------------------------------------------
date: Thu, 15 Jun 2006 07:20:02 -0700   author:   MPH

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us