Hello all,I have this lotusscript action that in R5, successfully took the form data and created a calendar entry in the user’s mail file. This action is part of a separate database that tracks our companies’ Trade Shows and Sales Events. The user finds an entry that interests them, clicks on the “Add To My Calendar” button and it writes a new Event to their mail file calendar.
In R6, the script executes successfully as the message box at the bottom displays, however, when opening my calendar, there is no entry.
I am hoping that someone can look at this code and perhaps tell me that something changed in the R6 mail template that would cause this to not work as expected.
Here is the code:
Sub Click(Source As Button)
Dim db As Notesdatabase
Dim session As New NotesSession
Dim workspace As New notesuiworkspace
Dim uidoc As notesuidocument
Dim note As notesdocument
Dim item As NotesItem
Dim startdttm As NotesDateTime
Dim enddttm As NotesDateTime
Dim window As NotesDateRange
Dim names As String
Dim dur As Integer
Dim username As String
Set uidoc = workspace.currentdocument
Set note = uidoc.Document
Set item = note.GetFirstItem("EventStartDate")
Set startdttm = item.DateTimeValue
Set item = note.GetFirstItem("EventEndDate")
Set enddttm = item.DateTimeValue
Set window = session.CreateDateRange()
Set window.StartDateTime = startdttm
Set window.EndDateTime = enddttm
names = session.CommonUserName
dur = ((enddttm.TimeDifference(startdttm))+86400)/60
freeTime = session.FreeTimeSearch(window, dur, names, True)
Set db = New notesdatabase("", "")
Call db.openmail
Dim cEntry As New NotesDocument(db)
Dim rtitem As Variant
Dim itemIcon As NotesItem
username = session.UserName
cEntry.From = note.From(0)
cEntry.Subject = note.EventDescription
Set rtitem = note.GetFirstItem("Body")
Call rtitem.CopyItemToDocument(cEntry, "Body")
cEntry.Form = "Appointment"
cEntry.AppointmentType = "2"
cEntry.tmpWasMailed = "1"
cEntry.ExcludeFromView = "D"
cEntry.OrgTable = "P0"
cEntry.Location = note.Location
cEntry.calendarDateTime = note.datelist
Set itemIcon = New NotesItem(cEntry, "_ViewIcon", 9)
itemIcon.IsSummary = True
cEntry.Logo = "stdNotesLtr0"
cEntry.StartDate = note.EventStartDate
cEntry.EndDate = note.EventEndDate
Call cEntry.save(True, True)
Messagebox "This document has been added to your calendar. ", 0, "Add Complete"
End Sub
Thanks!
Doug Niman