Excel VBA to query user info from LDAP returns "Provider does not support the property"

37 Views Asked by At

TLDR;

  Dim cnn As New ADODB.Connection
  cnn.ConnectionString = "Provider=ADSDSOObject"
  cnn.Open

returns Provider does not support the property on line 3.

every variation of the above that I have tried returns the same.

Whole story

In excel, I want to create a look-up table to return user information from LDAP based on the user ID. The directory is very large, so loading the whole directory as a lookup table via Power Query is not feasible. Something like this is what I'm trying to achieve:

user ID Full Name Email
myUid My name form LDAP My Email from LDAP
urUid Ur name form LDAP Ur Email from LDAP

To achieve this, I am trying to create one or more UDFs (user defined function) in excel, which are powered by VBA.

In VBA it seems I need to use ADO (ActiveX Data Object) to connect to the ADSDSOObject provider.

Following instructions there, as well as all over SO and the greater internet, I have tried to initiate this connection, but it always fails with the above error.

I took the code down to the most simple version from all the examples and was able to identify that the error occurs when running the .open. Watching the cnn variable, I can see that this is the point when the Errors changes from empty to 1 and the details show the error message.

Before line 2:

enter image description here

After line 2:

enter image description here

I can see that the ConnectionString has been changed, but I can't identify which property is not supported by the provider...

The resultant connection string is Provider=ADsDSOObject;Encrypt Password=False;Mode=Read;Bind Flags=0;ADSI Flag=-2147483648;

Any help here is greatly appreciated.

0

There are 0 best solutions below