例: AppendItemValue method

  1. このスクリプトによって文書に新規に追加されるアイテムは、数値アイテム EstimatedCost とテキストアイテム Region の 2 つです。数値アイテムの値は 89、テキストアイテムの値は「Pacific Rim」です。
    Dim doc As NotesDocument
    '...set value of doc...
    Dim itemA As NotesItem
    Dim itemB As NotesItem
    Set itemA = doc.AppendItemValue( "EstimatedCost", 89 )
    Set itemB = doc.AppendItemValue( "Region", "Pacific Rim" )
    Call doc.Save( False, True )
  2. 次のスクリプトは拡張クラス構文を使用して、上記の例と同じ内容を実行します。上記のスクリプトと異なるのは、文書に EstimatedCost または Region という名前のアイテムがすでにあるとき、その値が新しい値と置き換えられる点です。
    doc.EstimatedCost = 89
    doc.Region = "Pacific Rim"
    Call doc.Save( False, True )
  3. 次のスクリプトは文書に Contacts というテキストアイテムを新規作成して、新しい 3 つの値を加えます
    Dim doc As NotesDocument
    '...set value of doc...
    Dim stringArray ( 1 To 3 ) As String
    stringArray( 1 ) = "Chrissa Ehrhardt"
    stringArray( 2 ) = "Allegra Pisarro"
    stringArray( 3 ) = "Esteban Garcia"
    Call doc.AppendItemValue( "Contacts", stringArray )
    Call doc.Save( False, True )
  4. 次のスクリプトは拡張クラス構文を使用して、上記の例と同じ内容を実行します。上記のスクリプトと異なるのは、文書に Contacts というアイテムがすでにあるとき、その値が Chrissa Ehrhardt、Allegra Pisarro、Esteban Garcia という値と置き換えられる点です。
    Dim stringArray ( 1 To 3 ) As String
    stringArray ( 1 ) = "Chrissa Ehrhardt"
    stringArray ( 2 ) = "Allegra Pisarro"
    stringArray ( 3 ) = "Esteban Garcia"
    doc.Contacts = stringArray
    Call doc.Save( False, True )
  5. 次のスクリプトは、文書に DueDate という日時アイテムを新規に作成します。このアイテムの値は 08/15/95 12:00:00 AM になります。
    Dim doc As NotesDocument
    '...set value of doc...
    Call doc.AppendItemValue("DueDate",  _
    Datenumber(1995, 8, 15))
    Call doc.Save( False, True )
  6. 次のスクリプトは拡張クラス構文を使用して、上記の例と同じ内容を実行します。文書に DueDate というアイテムがすでにある場合、その値は 08/15/95 12:00:00 AM と置き換えられます。
    doc.DateDue = Datenumber( 1995, 8, 15 )
    Call doc.Save( False, True )