Slowly teaching myself code still. Very slowly, and working on customising buttons which we already currently use for support purposes. The following is straight forward - returns the profile to the sender. In particular I’d be interested to see if all the dimming of UIdoc & workspace is neccessary to get the sender (“From”) value. Could see how else to get items from the current document. Would you change anything?
Dim s As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Dim itemRich As NotesRichTextItem
'Get the required profile document
Set db=s.currentdatabase
Set doc = db.GetProfileDocument("OutofOfficeProfile")
'Build the document to be returned to sender
Set maildoc=db.createdocument
maildoc.form="memo"
maildoc.subject="Out of Office profile for " & s.CommonUserName
Set itemRich=New NotesRichTextItem(maildoc,"body")
Call itemRich.AddNewline(3)
Call itemRich.appendtext("*******************************" & doc.form(0) & "******************************")
Call itemRich.AddNewline(1)
Forall item In doc.Items
Call itemRich.appendtext(item.name & " : " & item.type & " - " & item.text)
Call itemRich.AddNewline(1)
End Forall
'If user should choose Administrator use this;
’ recip = Inputbox("Administrator to send to; ")
'Otherwise ascertain the sender to reply to;
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim recip As Notesitem
Dim fromdoc As NotesDocument
Set uidoc = workspace.CurrentDocument
Set fromdoc = uidoc.document
Set recip = fromdoc.GetFirstItem("From")
'send the profile document
Call maildoc.Send(False, recip)
'display a box to say it has been sent
Dim recipstr As String
recipstr = fromdoc.From(0)
Messagebox("Profile has been sent to " & recipstr)
'close the document
Call uidoc.Close