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.
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.
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.
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); } ------------------------------------------------