Search code examples
vbaldaplotus-domino

How to get user-Information from domino-server via vba


I writing a macro for ms word, that starts when the document is loaded and fills a few fields with user information (tel,email etc.). I want this information to come form our domino-servers, as they are our primary database.

I have tried using notes objects in vba to establish a session on the server, but that requires that user to keep their notes-client open(as far as I know), so thats not an option.

Currently I am trying to get the information via ldap request(the domino-server runs the ldap-service), however I cant find information on how the code and search string has to look like. The last site I tried was this one (http://www.selfadsi.org/bind.htm), using the "Bind using special credentials" variant.

But I am getting a protocol error.(the string proably needs to be adjusted for connecting to domino, I tried "LDAP://[Server-FQN]/dc=DE" hoping it would show me all users registered as C=DE, but it did not work.)

I have also searched through IBMs Support Site and Knowledge-Center, but could not find the info I need.

If anyone could provide me an example on how to connect to the domino ldap and pull the information for a user, I would be very grateful.


Solution

  • There are two different sets of Notes objects available to you in VBA. There are OLE objects, which you access this way:

    Set Session = CreateObject("Notes.NotesSession")
    

    And there are COM objects, which you access this way:

    Set Session = CreateObject("Lotus.NotesSession")
    

    The key differences between them are that OLE objects require that the Notes client must be running and they also include the "front-end" classes like Notes.NotesUIWorkspace that can actually drive the Notes client, while the COM objects do not require that the Notes client is running (though either it, or the Domino server, must be installed) and it does not provide the front-end classes.

    If you want to stick with the LDAP approach, the first thing you should probably do is download an LDAP client. I like the SoftTerra LDAP browser, but I've also heard that a lot of people like the Apache Directory Studio. Browsing the tree is really the best way to figure out what queries will get you the info you need.