Setting Reminder\Alarms from any application
Have you ever wanted to have your application set a reminder\alarm in the user's mailfile (with pop-up and all)?
Have you ever wanted to have your application set a reminder\alarm in the user's mailfile (with pop-up and all)?
Well, here's a little function that'll do it for you. Just parse in the dateTime, the Pop-Up Text and Subject Text (for the calendar view), and all is done.
Sub createReminder( dateTime As notesDateTime, popUpStr As String, subjectStr As String ) '// DECLARATIONS Dim sess As New NotesSession Dim userMailDb As New NotesDatabase( "", "" ) Dim reminderDoc As NotesDocument Dim DTItem As NotesItem '// OPEN MAILFILE Call userMailDb.OpenMail '// CREATE DOCUMENT If userMailDb.IsOpen Then Print "Creating reminder..." Set reminderDoc = New NotesDocument( userMailDb ) With reminderDoc .Form = "Appointment" .ReplaceItemValue "$Alarm", 1 .ReplaceItemValue "$AlarmDescription", popUpStr .ReplaceItemValue "$AlarmMemoOptions", "" .ReplaceItemValue "$AlarmOffset", 0 .ReplaceItemValue "$AlarmUnit", "M" .Subject = subjectStr .Alarms = "1" .CalendarDateTime = dateTime.lsLocalTime .StartDate = dateTime.lsLocaltime .StartTime = dateTime.lsLocaltime .StartDateTime = dateTime.lsLocaltime .EndDate = dateTime.lsLocaltime .EndTime = dateTime.lsLocaltime .EndDateTime = dateTime.lsLocaltime .AppointmentType = 4 .ComputeWithForm False, False .Save True, False .PutInFolder( "$Alarms" ) End With Print "Creating reminder...Successful" Else Print "Creating Reminder...Error - Cannot open user's MailFile." End If End Sub