Manage Learn to apply best practices and optimize your operations.

Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x

A new feature in Lotus Notes 8 is the inclusion of a Recent Contacts view. If you're not a fan of the feature, insert this LotusScript code in a button and email it to your users. Clicking the button will clear the view and prevent repopulation.

With the introduction of the Recent Contacts view in Lotus Notes 8.x, I've found both myself and fellow Domino administrators wishing that this view was not populated and the function disabled.

Insert this LotusScript code into a button and email it to your users. Clicking on it will clear each user's Recent Contacts view and prevent repopulation.

Note: Be sure to create a log database called ClearContactsLog.nsf on your Domino server. Doing this will allow you to keep track of users who clicked the button.

Dim db As New NotesDatabase("","names.nsf")

      Dim logdb As New NotesDatabase("<server name>","ClearContactsLog.nsf")

      Dim view As NotesView

      Dim doc As NotesDocument

      Dim doc2 As NotesDocument

      Dim logdoc As NotesDocument

      Dim session As New NotesSession

      Dim stream As NotesStream

      Dim filename As String

      Dim Response As Integer

      Dim dateTime As New NotesDateTime( "" )

      Dim nam As NotesName

      Dim ErrorMsg As String

      Dim Status As String

      Dim item As NotesItem

     

      On Error Resume Next

     

      ' Store the name of the user running this

      Set nam = session.CreateName(session.UserName)

     

      ' Store the current date and time

      dateTime.LSLocalTime = Now

     

      ' Create the entry for the log

      Set logdoc = logdb.CreateDocument()

      locdoc.Form = "Log Entry"

     

      ' Set the view to clear for the local contacts

      Set view = db.GetView("(Recent Contacts)")

      If view.AllEntries.Count > 0 Then

            Set doc = view.GetFirstDocument

            Do While Not (doc Is Nothing)

                  Set doc2 = doc

                  Set doc = view.GetNextDocument(doc)

                  Call doc2.RemovePermanently(True)

            Loop

      End If

      If view.AllEntries.Count > 0 Then

            Response = Msgbox("The view was not cleared successfully!" + Chr(10) + Chr(13) + "Click on OK to return to Notes then contact the Help Desk.",0 + 48,"Error During Clearing of Recent Contacts ")

            ' Store what is to be saved in the log

            ErrorMsg = "Error During Clearing of Recent Contacts "

            Status = "View not cleared"

      End If

     

      ' Now, add the parameter line to the NOTES.INI

      filename = Left(db.FilePath, Len(db.FilePath) - 14) + "NOTES.INI"

      Set stream = session.CreateStream

      ' Use name of text file as subject

      If Not stream.Open(filename, "ASCII") Then

            Response = Msgbox("The process was aborted!" + Chr(10) + Chr(13) + "Click on OK to return to Notes then contact the Help Desk.",0 + 48,"Error During Clearing of Recent Contacts ")

            ' Store what is to be saved in the log

            ErrorMsg = "Error During Clearing of Recent Contacts "

            Status = "Cannot open INI file"

            Exit Sub

      Else

            ' Write the correct line to the bottom of the NOTES.INI

            stream.WriteText "DisableDPABProcessing=1" + Chr(10) + Chr(13)

            Response = Msgbox("The process has completed." + Chr(10) + Chr(13) + "Click on OK to return to Notes then close Notes and re-open it.",0 + 64,"Clearing of Recent Contacts  Completed")

            ' Store what is to be saved in the log

            Status = "Success"

      End If

      ' Write this information to the log file

      Call logdoc.AppendItemValue("A$LOGTIME",Cdat(dateTime.DateOnly + " " + dateTime.TimeOnly))

      Call logdoc.AppendItemValue("A$PROGNAME", "Clearing of Recent Contacts ")

      Call logdoc.AppendItemValue("A$USER", nam.Common)

      Call logdoc.AppendItemValue("A$ACTION", Status)

      If ErrorMsg <> "" Then

            Call logdoc.AppendItemValue("A$ERRMSG", ErrorMsg)

      End If

      Call logdoc.Save(True,False)

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip library by member David White. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes/Domino technical tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

This was last published in October 2009

Dig Deeper on Lotus Notes 8

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

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

SearchExchange

SearchContentManagement

Close