Lotus Software logo
IBM Lotus Domino Designer 8.5
  Versions 8.5 and 8.5.1






Examples: RemoveItem method

  1. This script removes the Subject item from a document.
  2. Dim mainDoc As NotesDocument
    
    '...set value of mainDoc...
    Call mainDoc.RemoveItem( "Subject" )
    Call mainDoc.Save( True, True )
  3. This script removes all file attachments from a document.
  4. Dim doc As NotesDocument
    
    '...set value of doc...
    Call doc.RemoveItem( "$FILE" )
    Call doc.Save( True, True )
  5. This sub lets you change the name of any item in a document. First it uses ReplaceItemValue to put the contents of the item with the old name into a new item with the new name. Then it uses RemoveItem to remove the item with the old name.
  6. Sub changeField _
    
    ( doc As NotesDocument, oldName As String, _
    newName As String )
    If doc.HasItem( oldName ) Then
    Call doc.ReplaceItemValue( newName, _
    doc.GetItemValue( oldName ) )
    Call doc.RemoveItem( oldName )
    Call doc.Save( False, True )
    End If
    End Sub

    For example, to change the name of the phone item to officePhone without losing the item's value, a script makes the following call:

    Dim doc as NotesDocument
    
    '...set value of doc...
    Call changeField( doc, "phone", "officePhone" )
  7. This sub takes a collection of documents and removes the stored form from each document. It uses RemoveItem to delete the five fields that make up a stored form in a document: $TITLE, $INFO, $WINDOWTITLE, $BODY and $ACTIONS.
  8. Sub removeStoredForm_
    
    ( collection As NotesDocumentCollection )
    Dim doc As NotesDocument
    Set doc = collection.GetFirstDocument()
    While Not(doc Is Nothing)
    If doc.HasItem( "$TITLE" ) Then
    formName = doc.GetItemValue( "$TITLE" )
    Call doc.ReplaceItemValue( "Form", formName )
    Call doc.RemoveItem( "$TITLE" )
    Call doc.RemoveItem( "$INFO" )
    Call doc.RemoveItem( "$WINDOWTITLE" )
    Call doc.RemoveItem( "$BODY" )
    Call doc.RemoveItem( "$ACTIONS" )
    Call doc.Save( True, True )
    End If
    Set doc = collection.GetNextDocument(doc)
    Wend
    End Sub
Related topics
RemoveItem method




Library | Support | Terms of use |

Last updated: Monday, October 5, 2009