Manage Learn to apply best practices and optimize your operations.

Find Duplicate Names In Names.Nsf

Moving from 5 different (connected) mail platforms to one sometimes gives us
duplicate names in the names.nsf. I didn't find any script to easily find those
so had to make one myself.
Duplicates show up in a view with doclinks to the document in the names.nsf.
Mind you, I'm not a programmer so the code can probably be written a lot more
efficient. Anyway, it does the job...
It runs from a button on a navigator.
Dim db As Notesdatabase
Dim view As NotesView
Dim doc, nextDoc As NotesDocument
Dim sCreated As String
Dim sAuthor As String
Dim sModified As String
Dim Clast As Variant
Dim Docfullname As Variant
Dim NextDocfullname As Variant
Dim Doclastname As Variant
Dim Docfirstname As Variant
Dim Docmiddleinitial As Variant
Dim NextDoclastname As Variant
Dim NextDocfirstname As Variant
Dim NextDocmiddleinitial As Variant
Dim vCreated As Variant
Dim vAuthor As Variant
Dim vModified As Variant
Dim vMailSystem As Variant
Dim fn1 As String
Dim fn2 As String
Dim sMailSystem As String
Dim dFullName As String
Dim dCreated As String
Dim dModified As String
Dim dAuthor As String
Dim dmail As String
Dim dUID As String
Dim dRT As NotesRichTextItem
Dim x As String
Sub Click(Source As Navigator)
Dim session As New NotesSession
Dim boxType As Long, answer As Integer
boxType& = 1
answer% = Messagebox("OK to Clear Previous Results ?", boxType&, "Continue?")
If answer% = 2 Then
End
End If
DeleteFromView
Server$ = Inputbox$ ("Enter Server",,"Server/Domain")
AddresBook$ = Inputbox$ ("Enter File Name",,"Names.NSF")
Set db = New NotesDatabase( Server$, AddresBook$ )
Set view = db.GetView( "People" )
found = 0
Set doc = view.GetFirstDocument
Set nextDoc = view.GetNextDocument(doc)
Do While Not ( nextDoc Is Nothing )
DocLastName =doc.getitemvalue("LastName")
DocFirstname =doc.getitemvalue("FirstName")
DocMiddleInitial=doc.getitemvalue("MiddleInitial")
NextDocLastName =nextdoc.getitemvalue("LastName")
NextDocFirstname =nextdoc.getitemvalue("FirstName")
NextDocMiddleInitial=nextdoc.getitemvalue("MiddleInitial")
fn1 =DocLastname(0) & " , " & DocFirstName(0) & " " & DocMiddleInitial(0)
fn2=NextDocLastName(0) & " , " & NextDocFirstname(0) & " " &
NextDocMiddleInitial(0)
If fn1 = fn2 Then
found = found +1
sfound$ = found
dFullName = fn1
vCreated = doc.Created
sCreated = Cdat(vCreated)
dCreated = sCreated
Clast = Ubound(doc.Authors)
sAuthor = doc.Authors( Clast )
dAuthor = sAuthor
sModified = doc.LastModified
dModified = sModified
vMailSystem = doc.getitemvalue("MailSystem")
sMailsystem = vMailsystem(0)
MailSystem
dMail = sMailsystem
dUID = doc.UniversalID
x = 0
Call CreateDocs
dFullName = fn2
vCreated = Nextdoc.Created
sCreated = Cdat(vCreated)
dCreated = sCreated
Clast = Ubound(Nextdoc.Authors)
sAuthor = Nextdoc.Authors( Clast )
dAuthor = sAuthor
sModified = Nextdoc.LastModified
dModified = sModified
vMailSystem = Nextdoc.getitemvalue("MailSystem")
sMailsystem = vMailsystem(0)
MailSystem
dMail = sMailsystem
dUID = Nextdoc.UniversalID
x = 1
Call CreateDocs
x = 0
Set doc = nextDoc
Set nextDoc = view.GetNextDocument(doc)
Else
Set doc = nextDoc
Set nextDoc = view.GetNextDocument(doc)
End If
Loop
RefreshView
End Sub
Function MailSystem ()
If sMailSystem = "1" Then
sMailSystem = "Notes"
End If
If sMailSystem = "2" Then
sMailSystem = "cc:Mail"
End If
If sMailSystem = "3" Then
sMailSystem = "Other"
End If
If sMailSystem = "5" Then
sMailSystem = "Other Internet Mail"
End If
If sMailSystem = "6" Then
sMailSystem = "Pop or IMAP"
End If
If sMailSystem = "100" Then
sMailSystem = "None"
End If
End Function
Sub CreateDocs
Dim session As New NotesSession
Dim dbc As NotesDatabase
Dim docc As NotesDocument
Dim form As NotesForm
Set dbc = session.CurrentDatabase
Set docc = New NotesDocument(dbc)
Set form = dbc.GetForm ("Duplicates")
docc.Form = "Duplicates"
docc.dFullName = dFullName
docc.dCreated = dCreated
docc.dModified = dModified&LTWHATL

Dig Deeper on Lotus Domino Directory

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close