Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 检索exchange 2007的文件室列表时出现LDAP问题_C#_Ldap_Directoryservices_Exchange Server 2007 - Fatal编程技术网

C# 检索exchange 2007的文件室列表时出现LDAP问题

C# 检索exchange 2007的文件室列表时出现LDAP问题,c#,ldap,directoryservices,exchange-server-2007,C#,Ldap,Directoryservices,Exchange Server 2007,我正在尝试使用c#查找Exchange Server 2007的所有会议室。通过使用EWS托管API,我找到了一种简单的方法: 不幸的是,GetRoomList()不适用于Exchange Server 2007。我希望如果有些人已经工作过,或者知道如何在ExchangeServer2007上找到会议室,这将是一个很大的帮助。我想查看Exchange server上所有可用的会议室,然后使用它们的属性 是否有一种方法可以显示所有现有房间,然后使用其属性,如电话/备忘选项卡信息 我正在使用LDA

我正在尝试使用c#查找Exchange Server 2007的所有会议室。通过使用EWS托管API,我找到了一种简单的方法:

不幸的是,GetRoomList()不适用于Exchange Server 2007。我希望如果有些人已经工作过,或者知道如何在ExchangeServer2007上找到会议室,这将是一个很大的帮助。我想查看Exchange server上所有可用的会议室,然后使用它们的属性

是否有一种方法可以显示所有现有房间,然后使用其属性,如电话/备忘选项卡信息

我正在使用LDAP,但它不断给我错误“服务器无法运行”。我想可能是我用错了证件。因此,我尝试了谷歌,但它对我没有帮助

随函附上我的代码,请查收:-

        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"];

                ..........
        }
}
它给了我关于所附代码的错误:-
dir2.RefreshCache()
我不确定我做错了什么。我尝试过使用不同的LDAP值,如:-
使用(DirectoryEntry dir2=new DirectoryEntry(“LDAP://LDAP.google.com/DC=www,DC=google,DC=com”,null,null,AuthenticationTypes.Encryption))

使用(DirectoryEntry dir2=newdirectoryentry(“LDAP:///DC=www,DC=google,DC=com”,null,null,AuthenticationTypes.Encryption))

使用(DirectoryEntry dir2=newdirectoryentry(“LDAP://DC=www,DC=google,DC=com”,null,null,AuthenticationTypes.Encryption))

但是没有什么真正帮助我

你知道我做错了什么吗

随函附上堆栈跟踪,请查找:

 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()
如有任何帮助或建议,将不胜感激


提前谢谢

我想分享一下我做错了什么。它可以帮助别人。 它现在运转良好。问题是广告名不对。 请与IT部门或管理员确认您使用的Active Directory名称是否正确


干杯

如果您的计算机已加入域,您应该能够只执行DirectoryEntry dir2=new DirectoryEntry()。这行吗?仅供参考,在StackOverflow上,您需要单击答案旁边的复选标记,将解决问题的答案标记为已接受。人们不太愿意回答那些不这样做的人的问题。