Dim session As NotesSession
Dim db As NotesDatabase
Dim vw As NotesView
Dim doc As NotesDocument
Dim docMail As NotesDocument
Dim ndtNow As NotesDateTime
Dim ndtAlarm As NotesDateTime
Dim intCount As Integer
Dim strEvents As String
Dim strRepeat As String
Dim intRepeat As Integer
Sub Initialize
Set session = New NotesSession
Set db = session.CurrentDatabase
Set vw = db.GetView("($Alarms)")
Set doc = vw.GetFirstDocument
intCount = 0
Set ndtNow = New NotesDateTime(Now)
strEvents = ""
intRepeat = 0
While Not doc Is Nothing
If doc.GetItemValue("Repeats")(0) = "1" Then
If Instr (StrRepeat, doc.UniversalID) = 0 Then
strRepeat = strRepeat & doc.UniversalID & Chr(10)
Else
intRepeat = 1
End If
End If
If intRepeat = 0 Then
If doc.GetItemValue("Form")(0) = "Task" Then
Set ndtAlarm = New NotesDateTime(doc.GetItemValue("DueDateTime")(0))
Else
Set ndtAlarm = New NotesDateTime(doc.GetItemValue("StartDateTime")(0))
End If
If ndtAlarm.DateOnly = ndtNow.DateOnly Then
intCount = intCount + 1
strEvents = strEvents & intCount & ": " & doc.GetItemValue("Form")(0) & " " & ndtAlarm.TimeOnly & " " & doc.GetItemValue("Subject")(0) & Chr(10) & Chr(10)
End If
End If
intRepeat = 0
Set doc = vw.GetNextDocument(doc)
Wend
If intCount > 0 Then
Set docMail = db.CreateDocument
docMail.Subject = "DAILY AGENDA: " & intCount & " Event(s) For " & ndtNow.DateOnly
docMail.Body = strEvents
Call docMail.Send(False,"My Notes Name/OU/Company")
End If
End Sub
Forcing Access to SQL Server
9 years ago
Hard to read the text with the text and background color.
ReplyDeleteHowdy there! Lotus Notes rules!!
ReplyDeleteNice agent but it only works for calendar entries that have alarms. How can I make it work if the entries that don't have alarms?
ReplyDeleteThanks,
Greg