I was wondering if there is a security issue with the NAMELookup/NAMELookup2 functions. I am trying to retrieve the content of the whole address book located on the server (Domino directory), but I always get 0 match. I have no problem lookingup for a specific name though.
Any idea? Or anybody knows of a good information source when developing with the C or C++ Lotus API?
I’m not aware of any security implications - the address books are supposed to make directory info public. Can you post the code containing the call to NAMELookup2 and I’ll have a look.
Are you making sure you follow the advice in the API reference, i.e.
NumNames - Number of names being looked up. This parameter must be greater than 0. If Flags specify NAME_LOOKUP_ALL and Names = “”, then specify NumNames = 1.
I am logged on to a Lotus session using the LNNotesSession object to Init a Lotus session rather than calling NotesInit, but in any case, I always have 0 in NumMatches when I am trying it against my Domino Directory. Again, lookingup for a name, with 0 instead of NAME_LOOKUP_ALL and by adjusting the Names parameter (the “” next to 1, )for a name to lookup, the lookup is succesfull. I also have no problem when sServer is “” or NULL, which correspond to my local address book.
OK. I can be stupid sometimes . All I had to do is to use the NAME_LOOKUP_UPDATE flag or’ed with the NAME_LOOKUP_ALL flag… Not that its the first time I use an API call with flags, but there are those times…
Anyway it works now! What is even more cool is that querying the $users view gives me everything I need : groups and simple users, so I’ll be able to display a cute address book myself!
By the way, if any of you is wondering what can be used for the items parameter, let’s say you are interested in Group items, just open a group, right click on it, select document properties in the popup menu, go to second tab and here you are! All the available fields are usable for the NameLookup items parameter!
Subject: Carefully reconsider NAME_LOOKUP_UPDATE flag
All I had to do is to use the NAME_LOOKUP_UPDATE flag or’ed with the NAME_LOOKUP_ALL flag
Only use the NAME_LOOKUP_UPDATE flag only if it is absolutely critical to have the view updated first. Otherwise you may impact server performance. You should usually let the updater task take care of view updates.