Hi,
I am trying to create a button which will create repeating reminders in the user’s calendar. I’m trying to do it through the backend as that makes it easier for users. The code was working via the front end, but it doesn’t seem to now. It just sets up an initial reminder entry, which doesn’t repeat. Debugging isn’t helping. Everything seems to be fine, except that the details of the repeat are ignored. Can someone please shed some light on this?
Here’s my code:
Dim Session As NotesSession
Dim Workspace As NotesUIWorkspace
Dim dbMail As NotesDatabase
Dim docMail As NotesDocument
Dim vMailAddress As Variant
Dim dtStart As NotesDateTime, dtEnd As NotesDateTime, dtNow As NotesDateTime
Dim drAppointment As NotesDateRange
Dim uiAppointment As NotesUIDocument
Const sStartDateTime = "10/07/2009 13:30:00"
Const sMessage = "A reminder to shut the blinds, turn off your monitor, and be green for the weekend."
Dim vFreeTime As Variant
Dim bContinue As Boolean
Set Session = New NotesSession
Set dtNow = New NotesDateTime("")
dtNow.SetNow
Set dtStart = New NotesDateTime(sStartDateTime)
Set dtEnd = dtStart
Call dtEnd.AdjustYear(1)
Set Workspace = New NotesUIWorkspace
vMailAddress = Evaluate("@MailDBName")
Set dbMail = New NotesDatabase(vMailAddress(0), vMailAddress(1))
Dim doc As NotesDocument
'Set doc = New NotesDocument (dbMail)
Set doc = dbMail.CreateDocument
Set dtStart = dtNow
doc.Form = "Appointment"
doc.Subject = "Green IT Reminder"
doc.tmpAppointmentType = "4"
doc.AppointmentType = "4"
doc.StartDate = dtStart.DateOnly
doc.StartTime = dtStart.TimeOnly
doc.Body = sMessage + Chr$(10)
doc.ReplaceItemValue "$Alarm", "1"
doc.ReplaceItemValue "_ViewIcon", 10
doc.ReplaceItemValue "CalendarDateTime", dtStart
doc.ReplaceItemValue "StartDate", dtStart.DateOnly
doc.ReplaceItemValue "StartDateTime", dtStart
doc.ReplaceItemValue "Repeats", "1"
doc.ReplaceItemValue "RepeatUnit", "W"
doc.ReplaceItemValue "RepeatInterval", "1"
doc.ReplaceItemValue "RepeatHow", "F"
doc.ReplaceItemValue "RepeatFor", 2
doc.Save True, False
doc.ReplaceItemValue "StartTime", dtStart.TimeOnly
doc.ReplaceItemValue "StartTimeZone", dtStart.TimeZone
doc.ReplaceItemValue "EndDate", dtStart.DateOnly
doc.ReplaceItemValue "EndDateTime", dtStart
doc.ReplaceItemValue "EndTime", dtStart.TimeOnly
doc.ReplaceItemValue "EndTimeZone", dtStart.TimeZone
doc.ReplaceItemValue "tmpStartDate1", dtStart
doc.ReplaceItemValue "tmpStartDateTZText", dtStart
doc.ReplaceItemValue "tmpStartTimeTZText", dtStart
doc.ReplaceItemValue "tmpEndDateTZText", dtStart
doc.ReplaceItemValue "tmpEndTimeTZText", dtStart
doc.ComputeWithForm True,False
doc.Save True, False
Thanks.