Finding dead names in all documents

Any idea, how to find dead names in all documents in entire database?

Report Format:

Doc Link1

        Field name1             Deadname1

        Field name2             Deadname2

Doc Link2

        Field name1             Deadname1

Note : Dead Names means user(s) left organisation and person document deleted from address book

Subject: Finding dead names in all documents

How complicated this is varies depending on what the nature of the user name fields you are looking for. If they are in $AUTHORS and $READERS fields then it is pretty easy. If they are sprinkled around in various other regular fields then you would need a list of which fields you want to compare to the PNAB.

Subject: RE: Finding dead names in all documents

Even usernames are stored in multi-value text fields…what is right approach/code to handle it…how you do it for authors/readers field?

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.

Subject: RE: Finding dead names in all documents

As Thomas stated, the AdminP process is supposed to handle removing a user’s name from all authors and readers fields when the user is deleted. You do not have to do anything to make this happen.

If you are dealing with normal fields that happen to contain user names then you have to go through all of the forms in your database and identify the names of the fields which contain this data. Once you have done this, then write an agent to analyze all of the documents looking for these fields. When the agent encounters one of the fields that you have identified, then have look up the name in the PNAB and if it does not find it then write the documentUNID, form name, field name, and the user name to a text file or a rich text field in a report document or something like that.

Subject: RE: Finding dead names in all documents

do you have that agent code ready handy with you…please share

Subject: RE: Finding dead names in all documents

Deepak,

No one is going to be able to provide you with ready-to-run code such as an agent to do what you want without you having to adapt it to suit your specific need. Stephen already gave you exactly the code that you are asking for in order to demonstrate to anyone who understands basic Notes fundementals how to solve your problem. You may need to hire someone with some experience to help you out on this one unless you are a really quick learner.

Subject: RE: Finding dead names in all documents

Hey Deepak,

I just saw another one of your posts that shows you do know what you are doing. My apologies if I offended you. Have a look at Stephen’s code.

Subject: RE: Finding dead names in all documents

I thought the AdminP process will only update the fields IF the person has configured the database to do that. Unfortunately, I have seen FAR TOO MANY DB where the developer did NOT do this.

Subject: RE: Finding dead names in all documents

That’s a good point but not exactly right- When a database is deployed, the db administrator must assign a server name as an “Administration Server” in the ACL properties. That’s what makes the ACL accessible to the ADMINP processing.

Unlike template default acl groups defined with [Groupname] this is not really a design property that you’d put in a template - I think you could enter it but then that design is locked in to a specific server name.

Subject: RE: Finding dead names in all documents

OR, if the list of dead names is known and is not too long then just full-text index the database and search for them one-by-one. If the users were set up and given notes ID files then someone in your organization should have a list of those IDs somewhere (otherwise someone should get their behind kicked).

Subject: RE: Finding dead names in all documents

I am just targetting just a report with names & document links and not really looking for the use of AdminP.

Subject: Finding dead names in all documents

If you mean find them and remove them, I think this is what Adminp does. Check the Administrator help file.

Subject: RE: Finding dead names in all documents

Currently I am looking to find them all for reporting purpose