Examples: OnBehalfOf property (NotesAgent - LotusScript®)

This agent sends mail with ownership and user information, including on whose behalf the agent runs.

Sub Initialize
  Dim session As New NotesSession
  Dim agent As NotesAgent
  Dim db As NotesDatabase
  Dim doc As NotesDocument
  Dim body As NotesRichTextItem
  Set agent = session.CurrentAgent
  Set db = session.CurrentDatabase
  Set doc = New NotesDocument( db )
  doc.Form = "Memo"
  doc.SendTo = session.EffectiveUserName
  doc.Subject = "Owner, user, effective user, on behalf of"
  Set body = New NotesRichTextItem(doc, "Body")
  Call body.AppendText("Owner = " & agent.Owner)
  Call body.AddNewLine(1)
  Call body.AppendText("User = " & session.UserName)
  Call body.AddNewLine(1)
  Call body.AppendText("Effective user = " & _
  Call body.AddNewLine(1)
  Call body.AppendText("OnBehalfOf = " & agent.OnBehalfOf)
  Call doc.Send( False )
End Sub