LotusScript is your only solution, and it is not all that difficult.
First, you need code to iterate through all your docs in your People db. There's two ways of doing that : either you go through all docs in the database, or you have a view that lists the docs you want and you iterate through that - which eliminates a portion of useless checks on docs that do not concern you.
Going for the second way (seems quite feasible, after all, you need views, right ?), the iterate code would be like this :
Code:
dim session as new notessession
dim db as notesdatabase
dim view as notesview
dim doc as notesdocument
dim olddoc as notesdocument
set db = session.currentdatabase
set view = db.getview("[i]viewname[/i]")
set doc = view.getfirstdocument
do while not(doc is nothing)
...
set olddoc = doc
set doc = view.getnextdocument(olddoc)
delete olddoc
loop
So, we have our iteration procedure. Now, for each document, you want to check the names.nsf for the corresponding People document. First thing : do you have the proper hierarchical name in you people db ? It's a lot simpler if you do. Since I'm lazy, I will assume that is the case ;-).
So, assuming you have the same name format in both dbs, we need to do the following :
- declare and open the names.nsf
- get the right view for our lookup
- use the view in our iteration code
The declaration can be made before iterating, makes more sense like that. Just one thing, we want to be sure that the names.nsf is available before going forward, so we make the check like this :
Code:
dim servernab as notesdatabase
dim nabview as notesview
dim nabdoc as notesdocument
set servernab = session.getdatabase(db.server,"names.nsf")
if servernab.isopen then
set nabview = servernab.getview("($PeopleLookup)")
...
end if
So, here we have code that declares the names.nsf db and, if available, gets the associated People view we need.
Finally, we want to check if the doc in the People.nsf corresponds to a Person doc in the names.nsf.
To do that, I'll suppose that both docs have a field containing the name in full hierarchical format. We can then use the name in the doc in the Person db to do the lookup in the serve NAB. If we find a document, it follows that we have a match.
Code:
dim username as string
username = doc.fullname(0)
set nabdoc = nabview.getdocumentbykey(username,true)
if not(nabdoc is nothing) then
'we have a match !
end if
Now, if we put all this together, we get :
Code:
dim session as new notessession
dim db as notesdatabase
dim servernab as notesdatabase
dim view as notesview
dim nabview as notesview
dim doc as notesdocument
dim olddoc as notesdocument
dim nabdoc as notesdocument
dim username as string
set db = session.currentdatabase
set servernab = session.getdatabase(db.server,"names.nsf")
if servernab.isopen then
set nabview = servernab.getview("($PeopleLookup)")
set view = db.getview("[i]viewname[/i]")
set doc = view.getfirstdocument
do while not(doc is nothing)
username = doc.fullname(0)
set nabdoc = nabview.getdocumentbykey(username,true)
if not(nabdoc is nothing) then
'we have a match !
end if
set olddoc = doc
set doc = view.getnextdocument(olddoc)
delete olddoc
loop
end if
Of course, if there is a match, you need to decide what to do. I'll leave that up to you for now

.
Pascal.