- This example uses the New method of the NotesItem class to add a new item named ModifiedBy to each document in a database and to give it the value of the user name for the Notes session.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim item As NotesItem
Set db = session.CurrentDatabase
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument()
While Not(doc Is Nothing)
Set item = New NotesItem _
(doc, "ModifiedBy", session.UserName)
Call doc.Save(True, False)
Set doc = dc.GetNextDocument(doc)
Wend
End Sub
- This example uses the AppendItemValue method of the NotesDocument class to add a new item named ModifiedBy to each document in a database and give it the value of the user name for the Notes session.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument()
While Not(doc Is Nothing)
Call doc.AppendItemValue _
("ModifiedBy", session.UserName)
Call doc.Save(True, False)
Set doc = dc.GetNextDocument(doc)
Wend
End Sub
- This example uses the Values property of the NotesItem class to change the value of the item named ModifiedBy in each document in a database. Loops are used to access all values of all items with the name ModifiedBy.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim item As NotesItem
Set db = session.CurrentDatabase
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
While Not(doc Is Nothing)
docItems = doc.Items
Forall docItem In docItems
If docItem.Name = "ModifiedBy" Then
itemValues = docitem.Values
Forall itemValue In itemValues
itemValue = "Anonymous"
End Forall
docItem.Values = itemValues
End If
End Forall
Call doc.Save(True, False)
Set doc = dc.GetNextDocument(doc)
Wend
End Sub
- This example uses the ReplaceItemValue method of the NotesDocument class to change the value of the item named ModifiedBy in each document in a database. The result in each document is a single item named ModifiedBy with a single value.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument()
While Not(doc Is Nothing)
Call doc.ReplaceItemValue _
("ModifiedBy", "Anon3")
Call doc.Save(True, False)
Set doc = dc.GetNextDocument(doc)
Wend
End Sub