Domino Code Fragment

Code Name*
Removing an Item from All Documents in the Database
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.14.253.221
Description*
Removing an Item from All Documents in the Database
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Used in a Button or Agent!
Removing an iten is straight forward - you can use either the RemoveItem method of
NotesDocument or the Remove method of NotesItem. This example uses RemoveItem.

Sub Initialize
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Set db = session.CurrentDatabase
    Set dc = db.AllDocuments
    For i = 1 To dc.Count
         Set doc = dc.GetNthDocument(i)
         REM CONDITIONAL ADDED SO ONLY DOCS WITH CORRECT FORM ARE USED
         If doc.Form(0) = "FormName" Then
              Call doc.RemoveItem("FieldName")
              Call doc.Save(True, False)
         End If
    Next
End Sub