I need to connect to MS Exchange for getting the company accounts list. With some languages such as VB Script, Java,.. and so on there is a way to do that with LDAP protocol.
Could you please give me a way to do that in 1C:Enterprise? Or Is there any way to connect MS Exchange from 1C:Enterprise?
Unfortunately the program throws exception with the content that LDAP path is not correct.
I tried to input the correct company LDAP path but get the same exception although my LDAP path is correct because it's login successfully with Active Directory Explorer.
Could you suggest another way to connect Active Directory?
I tried your solution and get the following exception message: "..Error calling context method (Execute) RecordSet = Command.Execute(); because: An exception has occurred (Provider): Table does not exist."
Could you please try to run this code script in your 1C:Enterprise environment?
The updated code is below:
Code
&AtServer
Procedure LoginAD()
strTarget = "<LDAP:\/\/localhost\/>";
Connection = New COMObject("ADODB.Connection");
Connection.Provider = "ADsDSOObject";
Connection.Open("Active Directory Provider");
Command = New COMObject("ADODB.Command");
Command.ActiveConnection = Connection;
Command.CommandText = "SELECT Name, ADsPath FROM '" + strTarget + "' WHERE objectCategory = 'user'";
Command.CommandType = 1;
RecordSet = New COMObject("ADODB.RecordSet");
RecordSet = Command.Execute();
While Not RecordSet.EOF Do
Message(RecordSet.Fields("Name").Value);
RecordSe t.MoveNext();
EndDo;
EndProcedure