I have a list of users in a field , in a Form, I want to run an agent to pick this only document (as this is only one control document) that contains the list of users and get the user and it’s corresponding internet email ID from the names.nsf (which is a separate database.) The user list is listed as First Name + Space + LastName separated by commas.
I know I have to do a Forall loop to access one user by user and check again the nab.
Subject: How to get Internet email address from Public Names and Address Book using Lotus Script—Please help
This post pretty much shows why I almost always keep a hidden field that contains the user’s fully qualified Notes name it when generating a user list. If you had done that, you could use the ($VimPeople) view to do your lookup.
If it is early in your development cycle and you have the means to do so, I would list your user by their fully qualified Notes names, because otherwise, I guarantee that you will either miss users in the list or have duplicates with the system you have set up right now (how does it differentiate between John Smith/Org1 and John Smith/Org2?) Your script will never find them all.
You are barking up the wrong tree using a Forall loop to process this. First thing you will need to do is dump your user list to a List object or Array and loop through that using a For loop or a Do…While loop. You can then use the value you are currently accessing in the loop to do a lookup to the names.nsf (If you stick with firstname + space + lastname you will probably have to create your own view for the lookup in names.nsf. Once a match is made, you can get the internet address from the corresponding person doc.
However, if your user list is not a multivalue field, you’ll need to parse the data to add an element to the array every time it encounters a comma.
As you can see, this would be quite the undertaking, so I would suggest you search the Notes Designer Documentation looking for info on For loops, Do…While loops and the NotesDatabase, NotesView and NotesDocument objects, paying special attention to the GetDocumentByKey method of the NotesView.
In this case, I have a list (zMailUsers) of Hierarchical user names which I convert to Canonical format. Then I look up the users’ mail files from column 7 of the ($Users) view in the Domino directory. I believe that the users’ internet addresses are stored in column 17 of this view. The ($Users) view contains entries in many formats so FirstName + space + LastName should work.