Subject: RE: Finding dead names in all documents
Things get a lot easier if you know what fields you want to check.
Basic idea would be (didn’t typed this in here - not validate for syntax errors)
Dim s as New NotesSession
dim thisDB as NotesDatabase
dim pab as Notesdatabase
dim pabUsersView As NotesView
dim thisDBAllDocsView As NotesView
Dim Doc as NotesDocument
Dim name as String
dim max as Integer, x as Integer, n as Integer
Dim deadname() As String
Dim DeadField() As String
Dim deadDocID() As String
Set thisDB = s.currentdatabase
Set thisDBAllDocView = thisDB.Getview(“All Document View”)
if thisDBALlDocView is Nothing then Exit Sub
Set pab = New NotesDatabase( “YourSrv”, “names.nsf” )
if pab is Nothing then Exit Sub
Set pabUsersView = pab.GetView(“($Users)”)
If pabUsersView is Nothing Exit Sub
n = 0
Set doc = thisDBAllDocView.GetfirstDocument
While Not Doc Is Nothing
max = ubound( doc.fieldname ) ' Look at looping through fieldname
for x=0 to max
name = trim(doc.fieldname(x))
if name <> "" then
dc = pab.GetAllDocumentsByKey( name, true)
if dc.count = 0 then ' name not found therefore a deadname
redim preserve deadname(n)
redim preserve deadField(n)
redim preserve deaddocID(n)
deadname(n) = name
deadfield(n) = fieldname
deadDocID(n) = doc.uniqueID
end if
end if
Next
Set doc = thisDBAllDocView.GetNextDocument( doc )
Wend
You will probably want to write out deadname and daadDocID to a report or create documents instead of using an array.