replaceItemValue (Java™)
Replaces all items of the specified name with one new item, which is assigned the specified value. If the document does not contain an item with the specified name, this method creates a new item and adds it to the document.
Defined in
Syntax
public Item replaceItemValue(String name, Object value)
throws NotesException
Parameters
String name
String. The name of the item or items you want to replace.
Object value
The value of the new item. The data type of the item depends upon the data type of value, and does not need to match the data type of the old item.
Data type of value |
Resulting item |
---|---|
String |
Text |
Integer |
Number |
Double |
Number |
DateTime |
Date-time item |
java.util.Vector with String, Integer, Double, or DateTime elements |
Multi-value text, number, or date-time item |
Item |
Same data type as the Item |
Return value
Item
The new item, which replaces all previous items with the same name.
Usage
To keep the changes, you must call save after calling replaceItemValue.
The IsSummary property of the new item defaults to true, which means that the item value can be displayed in a view or folder.
Do not use this method to replace the value of a rich text item (or MIME entity) unless you want to change it to a text item. To replace the contents of a rich text item, use Document.removeItem or RichTextItem.remove to delete the old item, Document.createRichTextItem to create a new one with the same name, and RichTextItem.appendText and other methods to provide the new content.