Examples: IsNames property

This script checks if a document has a SendTo field. If so, it mails the document to the recipients contained in SendTo. If not, it finds the first Names item on the document that contains at least one name, and mails the document to the user names contained in that Names item. If there is no Names item with at least one value, the document is not mailed.

Dim doc As NotesDocument
Dim item As NotesItem
Dim j As Integer
'...set value of doc...
Set item = doc.GetFirstItem( "SendTo" )
' if there's no SendTo item
' try to find another item of type Names, that has a value
If ( item Is Nothing ) Then
  Forall i In doc.Items
    If i.IsNames And ( i.Values( 0 ) <> "" ) Then
      Set item = i
      Exit Forall
    End If
  End Forall
  ' if we found an item of type Names
  ' mail the document to people in that item
  If Not ( item Is Nothing ) Then
    Call doc.Send( False, item.Values )
  End If
' if there is a SendTo item, no parameters needed     
' mail the document
Else
  Call doc.Send( False )
End If