A request that recently came to me was to put a reminder for an upcoming IT outage on the calendar for a specific list of users. To me, this seemed like a natural extension of the Company Communications Database. The form I used for setting up the reminder was just a modified mass email form that was already built. All the user has to do is select who gets the reminder, select when the reminder should go off, and enter the subject and body of the reminder. Below is the subroutine that actually puts the reminders on the user's calendar:

Sub SendReminder(person As NotesDocument, doc As NotesDocument)
  Dim mailfile As NotesDatabase
  Dim collection As NotesDocumentCollection
  Dim reminder As NotesDocument
  Dim item As NotesItem
  Dim body As NotesRichTextItem
  Dim oldbody As NotesRichTextItem
  Dim datetime As NotesDateTime
  
  Set mailfile = New NotesDatabase(person.MailServer(0),person.MailFile(0))
  If Not(mailfile.IsOpen) Then Exit Sub
  
  Set datetime = New NotesDateTime(doc.GetItemValue("calendardatetime")(0))
  Set collection = mailfile.Search(|Form = "Appointment" & ApptUNID = "| & doc.UniversalID & |"|,Nothing,0)
  
  If collection.Count = 0 Then
    Set reminder = mailfile.CreateDocument()
    reminder.Form = "Appointment"
    Set item = reminder.ReplaceItemValue("$Alarm",1)
    Set item = reminder.ReplaceItemValue("$AlarmOffset",0)
  '  Set item = reminder.ReplaceItemValue("$NoPurge",doc.GetItemValue("calendardatetime"))
    Set item = reminder.ReplaceItemValue("$PublicAccess","1")
    Set item = reminder.ReplaceItemValue("$CSVersion","2")
    Set item = reminder.ReplaceItemValue("_ViewIcon",10)
    Set item = reminder.ReplaceItemValue("Alarms","1")
    Set item = reminder.ReplaceItemValue("AppointmentType","4")
    Set item = reminder.ReplaceItemValue("ApptUNID",doc.UniversalID)
    Set item = reminder.ReplaceItemValue("Categories","Company Reminders")
    Set item = reminder.ReplaceItemValue("Chair","CN=Generic ID/O=Company")
    Set item = reminder.ReplaceItemValue("ExcludeFromView","D")
    Call item.AppendToTextList("S")
    Set item = reminder.ReplaceItemValue("OrgTable","C0")
    Set item = reminder.ReplaceItemValue("Principal","CN=Clark Construction/O=Clark")
    Set item = reminder.ReplaceItemValue("SequenceNum",1)
    Set item = reminder.ReplaceItemValue("UpdateSeq",1)
    Set item = reminder.ReplaceItemValue("WebDateTimeInit","1")
  Else
    Set reminder = collection.GetFirstDocument
    Set item = reminder.ReplaceItemValue("SequenceNum",reminder.SequenceNum(0) + 1)
    Set item = reminder.ReplaceItemValue("UpdateSeq",reminder.UpdateSeq(0) + 1)
    Call reminder.RemoveItem("Body")
  End If
  Set item = reminder.ReplaceItemValue("CalendarDateTime",doc.GetItemValue("calendardatetime")(0))
  Set item = reminder.ReplaceItemValue("EndDate",Datevalue(datetime.DateOnly))
  Set item = reminder.ReplaceItemValue("EndDateTime",doc.GetItemValue("calendardatetime")(0))
  Set item = reminder.ReplaceItemValue("EndTime",Timevalue(datetime.TimeOnly))
  Set item = reminder.ReplaceItemValue("StartDate",Datevalue(datetime.DateOnly))
  Set item = reminder.ReplaceItemValue("StartDateTime",doc.GetItemValue("calendardatetime")(0))
  Set item = reminder.ReplaceItemValue("StartTime",Timevalue(datetime.TimeOnly))
  Set item = reminder.ReplaceItemValue("Subject",doc.subject(0))
  Set oldbody = doc.GetFirstItem("Body")
  Set body = reminder.CreateRichTextItem("Body")
  Call body.AppendRTItem(oldbody)
  
  Call reminder.ComputeWithForm(True,False)
  Call reminder.Save(True,False,True)
End Sub

A couple of things that you should notice about the subroutine. First, a couple of NotesDocument objects are passed in, one pointing to the user's person document in the address book and the other pointing to the reminder document. Second, the agent is built to be able to update reminders that have already been created. The ApptUNID field will contain the UniversalID of the reminder document so that if the reminder document gets updated, the reminder on the user's calendar will also be updated, not duplicated. Finally, I only set the static calendar fields when the document is created. I think that I got all the required fields, but I might have missed one. Please drop me a line if you think I did.Putting Reminders on user's calendars

3; 1; 1; 1; 1; 0; 0; 1; 0 Access DeniedAccess Denied