< Back

Document Subject: Simple Out of Office agent
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#OutOfOffice or http://A555F9/nn.nsf/ByAlias/OutOfOffice

A company I worked for did not have an out of office agent. i was asked to switch it on for the previous developer. It is usually under tools in the menus. I knocked up this code and put it in a "after new mail has arrived" agent.




 The agent should be set up by a ddesigner.

 ' Simple Out of Office or Employee has left agent.

 ' copyright Adam Foster

 ' Can be republished only with permission of Adam Foster

 ' See http://www.NotesNinjas.com/#OutOfOffice for latest version and help

 Dim  s As New notessession
Dim db As notesdatabase
Set db = s.currentdatabase

Dim col As notesdocumentcollection
Set col = db.unprocesseddocuments

Dim mdoc As New notesdocument(db)

Dim doc As notesdocument
Set doc = col.getfirstdocument()
Do Until doc Is Nothing
 
 Set nextdoc = col.getnextdocument(doc)
 If doc.hasitem("AdamOOO")=False Then
  'ok not sent before
  mdoc.sendto=doc.from(0) 'set the destination back to who sent it
  mdoc.blindcopyto="Adam Foster" ' add a bcc if required
  mdoc.subject="Geoff has left please contact Key users. RE:" & doc.subject(0)
  Call mdoc.send(False)
  doc.AdamOOO="Sent " & Now
  Call doc.save(False,False)  
 End If
 Set doc = nextdoc
Loop

 

The agent is very simple but it works.