I am trying to find all Meeting rooms for Exchange Server 2007 using c#. I found an easy way to do this by using EWS Managed API:
http://msdn.microsoft.com/en-us/library/exchange/hh532566(v=exchg.80).aspx
Unfortunately, GetRoomLists() does not work for Exchange Server 2007. I am hoping if some has worked or know how can I find meeting rooms on exchange server 2007, that would be a great help. I want to see all the meeting room available on Exchange server and then want to use their properties.
Is there a way I can show all the existing room and then use its properties like Phone/Notes tab information?
I was working with LDAP but it keeps giving me error "The server is not operational". I thought may be I am using wrong credential. Therefore I tried with Google and it did not help me.
Enclosed please find my code:-
using (DirectoryEntry dir2 = new DirectoryEntry("LDAP://www.google.com/DC=www,DC=google,DC=com", null, null, AuthenticationTypes.Encryption))
{
dir2.RefreshCache();
DirectorySearcher adSearch = new DirectorySearcher(dir2);
adSearch.Filter = "(&(objectClass=*)(msExchRecipientDisplayType=7))";
SearchResultCollection adResult = adSearch.FindAll();
foreach (SearchResult item in adResult)
{
ResultPropertyCollection property = item.Properties;
ResultPropertyValueCollection name = property["name"];
ResultPropertyValueCollection proxyAddresses = property["proxyAddresses"];
ResultPropertyValueCollection legacyExchangeDN = property["legacyExchangeDN"];
..........
}
}
It gives me error on enclosed code :-
dir2.RefreshCache();
I am not sure, what I am doing wrong. I have tried with different LDAP values like :-
using (DirectoryEntry dir2 = new DirectoryEntry("LDAP://ldap.google.com/DC=www,DC=google,DC=com", null, null, AuthenticationTypes.Encryption))
using (DirectoryEntry dir2 = new DirectoryEntry("LDAP:///DC=www,DC=google,DC=com", null, null, AuthenticationTypes.Encryption))
using (DirectoryEntry dir2 = new DirectoryEntry("LDAP://DC=www,DC=google,DC=com", null, null, AuthenticationTypes.Encryption))
But nothing really helped me.
Do you know what I am doing wrong?
Enclosed please find the stack trace:
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.RefreshCache()
at Test_Exchange.Program.Main(String[] args) in C:\Inetpub\wwwroot\Test Exchange\Test Exchange\Program.cs:line 26
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Any help or suggestion would be greatly appreciated.
Thanks in advance !!