Google calendar has a feature where a person’s daily agenda is emailed to the user each morning at around 5 AM. It contains everything on the person’s calendar for that day. This is a nice feature in case someone forgets to check their calendar but does check email.
I’m trying to create an agent to do this. My LotusScript skills are limited to taking other people’s scripts and modifying them.
I’ve tried using the built-in Simple actions\Send Newsletter Summary and chose (CalSummary) but when I tested it, the agent showed that it was going through 12,000 documents so I canceled that out.
I imagine someone else is already doing what I want to accomplish. Can someone point me in the right direction?
Thanks in advance,
Greg
Subject: Found an excellent agent but needs some tweaking
I found this LotusScript at: http://1mooreblog.blogspot.com/ and it works but only if an alarm is set for the entry. Not all of my users set alarms and they don’t appear to be set by default.
Can someone advise on how I can make it work, regardless of whether there is an alarm for the calendar entry?
Thanks,
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