Examples: SetValueCustomDataBytes method

This agent sets an item in the current document to the value of a byte array.

Sub Initialize
  Dim session As New NotesSession
  Dim doc As NotesDocument
  Dim item As NotesItem
  Dim bytes(9) As Byte
  Set db = session.CurrentDatabase
  Set doc = session.DocumentContext  
  If doc.HasItem("TenBytesItem") Then
    Set item = doc.GetFirstItem("TenBytesItem")
    If item.Type = USERDATA Then
      REM Create custom data
      For i = 0 To 9 Step 1
        bytes(i) = i + 65
      Next
      REM Replace custom data item
      Call item.SetValueCustomDataBytes("TenBytesType", bytes)
      Call doc.Save(True, True, True)
    Else
      Messagebox "Not custom data",, "TenBytesItem"
    End If
  Else
    Messagebox "No such item",, "No TenBytesItem"
  End If
End Sub