locked
Giving error while working with LDAP "The server is not operational" RRS feed

  • Question

  • Hi ,

    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.

    After research I get to know I should use LDAP. I am 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 as my domain 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 !!



    • Edited by Rmittal Wednesday, November 21, 2012 4:55 PM
    • Moved by Jason Dot Wang Monday, November 26, 2012 5:53 AM This thread is about Exchange Server (From:Visual C# General)
    Wednesday, November 21, 2012 4:50 PM

Answers

  • Hi Jason,

    Thank you for your reply.

    I really appreciate it!!

    It is working well now.

    Cheers,

    Ratika

    • Marked as answer by Rmittal Monday, November 26, 2012 4:37 PM
    Monday, November 26, 2012 4:09 PM

All replies

  • Welcome!

    However, I think you would have better luck with this question in an Exchange Server forum. If you need assistance with C# itself, we will look forward to helping you.


    "Premature optimization is the root of all evil." - Knuth

    If I provoked thought, please click the green arrow

    If I provoked Aha! please click Propose as Answer

    Thursday, November 22, 2012 3:17 AM
  • Hi Rmittal,

      Welcome to MSDN Forum Support.

      You are more likely to get more efficient responses to Exchange Server Forum issues at http://forums.msexchange.org/ where you can contact Exchange Server  experts.


    Jason Wang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, November 26, 2012 5:53 AM
  • Hi Jason,

    Thank you for your reply.

    I really appreciate it!!

    It is working well now.

    Cheers,

    Ratika

    • Marked as answer by Rmittal Monday, November 26, 2012 4:37 PM
    Monday, November 26, 2012 4:09 PM