Tuesday 8 December 2015

Remove Lotus Notes Duplicate Items

Lotus Notes is an email client, which is used for business purposes mainly for the track, record & the activity of the employees. It was built by IBM and is based on client-server technology. Formerly it was recognized by the name of IBM Notes, it uses Lotus Domino as its email server. It serves as a good option over other email clients which supports the various versions of it. The files are created in Lotus Notes are in NSF format which contains separate contacts list, emails, calendars, events etc., information.


What Is The Need To Remove Duplicate Items From Lotus Notes?

NSF files are created in the archive folders which contains a series of small number of files having all the information required by the user to access the mailbox and other events. As the number of files are huge for any user to access the information contained within the file. Hence, there is a requirement for the user to combine these small NSF files and merge them to a single one. This will contain all the information without having to suffer from any content duplicity or data loss.

Solutions

There are some methods containing tips & tricks to remove the duplicity in Lotus Notes:

Method 1
To Create a View Agent

Create an agent and run the following code in it, this will delete the duplicate documents having same serial number.
The following code is used for this.

Code

Sub Initialize
 Dim ses As New NotesSession
            Dim selection As String
 Dim collection As NotesDocumentCollection
 Dim doc1 as Notesdocument
 Dim doc2 as Notesdocument
 Set G_db = ses.CurrentDatabase  

 Dim view As NotesView
 Dim count As Integer
 Set view = G_db.GetView("vSerial")
Set doc1 = view.getfirstdocument
 While Not (doc1 Is Nothing)
             Set doc2 = view.GetNextDocument(doc1)
  If Not (doc2 Is Nothing) Then
   If (doc1.serialNo(0) = doc2.serialNo(0)) Then
    '----Mark Delete document to 1------------
    doc2.Mark = "1"
    Call doc2.save(true,true)
   End If
  End if
  Set doc1 = view.GetNextDocument(doc1)
 Wend


'------Delete Document
            Dim dateTime As New NotesDateTime( "" )
 Selection = "(Form = ""FORM_NAME"" & Mark=""1"" )"
 Set collection = G_db.Search( Selection, dateTime, 0 )
 For j = 1 To collection.Count
  Set doc2 = collection.GetNthDocument( j )
                        Call doc2.remove(True)
 Next
End Sub

Method 2
Remove all documents

This method permanently deletes all documents in a collection from a database which is defined in:
NotesDocumentCollection
Syntax
Call notesDocumentCollection.RemoveAll( force )

Now create a View duplicate with vSerial having two columns, in which the first column is for “Serial No.” and the other is for “Date Created” in descending order.

Option Public
Option Explicit

Sub Initialize
 Dim ses As New NotesSession
 Dim G_db As NotesDatabase
 Dim view As NotesView


Dim doc1 As NotesDocument
 Dim doc2 As NotesDocument

 Set G_db = ses.CurrentDatabase  

 Set view = G_db.GetView("vSerial")
 Set doc1 = view.GetFirstDocument
 While Not doc1 Is Nothing
  Set doc2 = view.GetNextDocument(doc1)
  If Not doc2 Is Nothing Then
   If (doc1.serialNo(0) = doc2.serialNo(0)) Then
    Call doc1.Remove(True)
   End If
  End If
  Set doc1 = doc2             
 Wend
End Sub

Limitations

Although, there are some tricks which are handy to remove duplicate emails of inbox in Lotus Notes but their range to sort out the duplicity works in restricted situations and the resulting outcome is not satisfactory for a professional user specially.
Secondly, the integrity of the data suffers the loss along with some size limitations.

Conclusion

NSF Database is used by most users and there are a large number of files which are created in it. Accessing these files one by one is time consuming, especially if the content is duplicated. you can merge these NSF files & then remove duplicate items. Manual methods can help the user to some extent but later on limitations of it have to be suffered.

I hope the article helps users to know how to deal with the duplicate items in Lotus Notes and remove them using manual tricks.
For any query or suggestions, do comment.

0 comments:

Post a Comment