Send Calendar Entries To Your Phone Or Pager

This agent sends a description of all your calendar entries for the current day
to your phone or pager provided an eMail address. You just have to make it a
scheduled agent that runs daily (every morning...). You can customize it to
suite your needs.
'Declarations
Const SUBJECT = "Calendar Entry"
Const DESTINATION_ADDRESS = "you@phonepager.com" Const MAIL_SERVER =
"MAILSERVER/Notes/Lotus"
Const MAIL_FILE = "mail\mail.nsf"

Sub Initialize

Dim session As New NotesSession
Dim mailDB As NotesDatabase
Dim calendarView As NotesView
Dim todaysDate As New NotesDateTime (Today)
Dim docCol As NotesDocumentCollection
Dim notificationDoc As NotesDocument
Dim currentDoc As NotesDocument
Dim chair As NotesName
Dim itmDatetime As NotesItem
Dim startDateTime As NotesDateTime
Dim endDateTime As NotesDateTime
Dim location As String

Print "Calendar --> SMS - Starting..."

Set mailDB = New NotesDatabase (MAIL_SERVER, MAIL_FILE)
Set calendarView = mailDB.GetView ("($Calendar)")

Set docCol = calendarView.GetAllDocumentsByKey (todaysDate, False)

Set notificationDoc = New NotesDocument (session.CurrentDatabase)

For i = 1 To docCol.Count

Set currentDoc = docCol.GetNthDocument(i)

notificationDoc.SendTo = DESTINATION_ADDRESS
notificationDoc.Subject = SUBJECT

Set chair = New NotesName (currentDoc.From (0))

Set itmDateTime = currentDoc.GetFirstItem ("StartDate")
Set startDateTime = itmDateTime.DateTimeValue
Set itmDateTime = currentDoc.GetFirstItem ("EndDate")
Set endDateTime = itmDateTime.DateTimeValue

If Instr ( currentDoc.Location (0), "/") > 0 Then
location = Trim (Left (currentDoc.Location (0), Instr (currentDoc.Location
(0), "/") - 1))
Else
location = currentDoc.Location (0)
End If

notificationDoc.Body = "Subject :" + Chr(13) + RemoveFrenchChars (Trim (Left
(currentDoc.Subject (0), 26))) _
+ Chr (13) + "Date :" + Chr(13) + startDateTime.DateOnly _
+ Chr (13) + "Time :" + Chr(13) + Format (startDateTime.TimeOnly, "Short
Time") + "-" + Format (endDateTime.TimeOnly, "Short Time") _
+ Chr (13) + "Location :" + Chr(13) + location _
+ Chr (13) + "Chair :" + Chr(13) + RemoveFrenchChars (chair.Common)

Call notificationDoc.Send (False)
Call session.UpdateProcessedDoc (currentDoc)
Next i

Print "Calendar --> SMS - Done."

End Sub

This was first published in November 2000

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.