
ADDRESS BOOK
Find Duplicate Names In Names.Nsf
Jan de Vos 05.13.2000
Rating: --- (out of 5)




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.
Code
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<WHATL
 |

|
Rate this Tip
|
To rate tips, you must be a member of SearchDomino.com. Register now
to start rating these tips. Log in if you are already a member.
|


');
// -->
DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.
|
 |
|
|
 |
|
 |