.
HCLSoftware Business Partner
Domino Consulting Services
CRUCIAL Notes Tools
+1
212-599-2048
Domino Consulting Services
CRUCIAL Notes Tools
Domino administration
Notes development
Chat now
.
EN - English
CN - 中文
JP - 日本語
DE - Deutsch
FR - Français
BR - Português
RU - Pу́сский
IT - Italiano
IN - हिन्दी
ES - Español
KR - 한국어
ID - Indonesia
NL - Dutch
TR - Türkçe
SA - العربية
SE - Svenska
NO - Norsk
PL - Polski
TH - ไทย
DK - Dansk
MY - Malay
PH - Filipino
GR - Ελληνικά
FI - Suomi
IL - עברית
IE - Gaeilge
CZ - Čeština
UA - Українська
RO - Română
VN - Tiếng Việt
BD - বাংলা
HU - Magyar
Need a Domino Consultant? Call NotesMail +1 212-599-2048
-
HCLSoftware Business Partner
LOTUSSCRIPT/COM/OLE CLASSES
Examples: Creating an item and assigning values
1. 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
2. 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
3. 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
4. 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
See Also
Creating an item and assigning values in LotusScript classes
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Feedback on
Help
or
Usability
?
Help on Help
All Help Contents