I have reviewed the forum for a resolution and am still having problems. I have a Lotus Script that on the QueryClose event of a form , which is opened in a dialog box, a Calendar Entry is created on the user’s calendar. This works GREAT for an Appointment, Reminder or All Day Event, however I am having problems getting the invitees of the Invitation into the form and to display when the entry is opened from the calendar. Below is my code. Any help would be greatly appreciated.
NOTE: I was able to populate some of the other hidden fields (ie: tmpRequiredAttendees, AltSendTo) that hold the invitees, however the EnterSendTo and SendTo fields will not populate.
Sub Queryclose(Source As Notesuidocument, Continue As Variant)
Dim NotesSession As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim Doc As NotesDocument
Dim db As NotesDatabase
Dim UIDoc As NotesUIDocument
Dim CurDoc As NotesDocument
Set CurDoc = workspace.CurrentDocument.document
Set uidoc = workspace.CurrentDocument
Dim item As NotesItem
Dim sdate As NotesDateTime
Dim edate As NotesDateTime
Dim edatestr As String
Dim sdatestr As String
Dim wsubject As String
If CurDoc.ToDoType(0) = "Calendar" Then
Dim werror As String
werror = ""
If Len(CurDoc.AISubject(0)) = 0 Then
werror = "Action Item" & Chr(10) & Chr(13) & werror
Call uidoc.GotoField( "AISubject" )
Continue = False
End If
If Len(CurDoc.AIType(0)) = 0 Then
werror = "Calendar Entry" & Chr(10) & Chr(13) & werror
Call uidoc.GotoField( "AIType" )
Continue = False
End If
If Len(CurDoc.StartDate(0)) = 0 Then
werror = "Date" & Chr(10) & Chr(13) & werror
Call uidoc.GotoField( "StartDate" )
Continue = False
End If
If CurDoc.AIType(0) = "All Day Event" Then
Continue = True
Else
If Len(CurDoc.StartTime(0)) = 0 Then
werror = "Time" & Chr(10) & Chr(13) & werror
Call uidoc.GotoField( "StartTime" )
Continue = False
End If
End If
If CurDoc.AIType(0) = "Invitation" Then
If Len(CurDoc.Invitees(0)) = 0 Then
werror = "Invitees" & Chr(10) & Chr(13) & werror
Call uidoc.GotoField( "Invitees" )
Continue = False
End If
End If
If Len(werror) > 0 Then
Messagebox "The following fields must be filled in to create a Calendar Entry:" & Chr(10) & Chr(13) & werror, 16, "Error"
Exit Sub
End If
’ If Len(CurDoc.StartDate(0)) > 0 Then
’ break MailDB into server and mail file name
Dim vResult As Variant
vResult = Evaluate ({@Explode (MailDB; ";")}, CurDoc)
If (Ubound(vResult) = 0 ) Then
Set db = NotesSession.GetDatabase("", vResult(0))
Else
Set db = NotesSession.GetDatabase(vResult(0), vResult(1))
End If
Set doc = db.CreateDocument
doc.form = "Appointment"
Select Case CurDoc.AIType(0)
Case "Appointment"
' concatenate date and time and create DateTime object
' note: occurance 0 of StartTime is start time, 1 is end time
sdatestr = CurDoc.StartDate(0) & " " & CurDoc.StartTime(0)
edatestr = CurDoc.StartDate(0) & " " & CurDoc.StartTime(1)
Set sdate = New NotesDateTime( sdatestr )
Set edate = New NotesDateTime( edatestr )
doc.AppointmentType = "0"
doc.~_ViewIcon = 160
Case "Invitation"
' concatenate date and time and create DateTime object
' note: occurance 0 of StartTime is start time, 1 is end time
sdatestr = CurDoc.StartDate(0) & " " & CurDoc.StartTime(0)
edatestr = CurDoc.StartDate(0) & " " & CurDoc.StartTime(1)
Set sdate = New NotesDateTime( sdatestr )
Set edate = New NotesDateTime( edatestr )
doc.AppointmentType = "3"
'doc.AltRequiredNames = Evaluate ({@Explode (@Name([CN];Invitees2); ";")}, CurDoc)
'doc.AltSendTo = Evaluate ({@Explode (Invitees2; ";")}, CurDoc)
doc.EnterSendTo = Evaluate ({@Explode (Invitees2; ";")}, CurDoc)
'doc.REQUIREDATTENDEES = Evaluate ({@Explode (@Name([CN];Invitees2); ";")}, CurDoc)
doc.SendTo = Evaluate ({@Explode (Invitees2; ";")}, CurDoc)
'doc.tmpRequiredAttendees = Evaluate ({@Explode (Invitees2; ";")}, CurDoc)
doc.~_ViewIcon = 158
Case "Reminder"
' concatenate date and time and create DateTime object
' note: occurance 0 of StartTime is start time, 1 is end time
sdatestr = CurDoc.StartDate(0) & " " & CurDoc.StartTime(0)
edatestr = CurDoc.StartDate(0) & " " & CurDoc.StartTime(0)
Set sdate = New NotesDateTime( sdatestr )
Set edate = New NotesDateTime( edatestr )
doc.AppointmentType = "4"
doc.~_ViewIcon = 10
Case "All Day Event"
' concatenate date and time and create DateTime object
' note: occurance 0 of StartTime is start time, 1 is end time
sdatestr = CurDoc.StartDate(0)
edatestr = CurDoc.StartDate(0)
Set sdate = New NotesDateTime( sdatestr )
Set edate = New NotesDateTime( edatestr )
doc.AppointmentType = "2"
doc.~_ViewIcon = 9
End Select
Set rtitem = New NotesRichTextItem( doc, "Body" )
Call rtitem.AppendDocLink _
( CurDoc, CurDoc.Form(0) & " - " & CurDoc.AIType(0) & " with " & CurDoc.Company(0) )
Call rtitem.AppendText( " <---- Doclink to " & CurDoc.Form(0))
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText("Company: " & CurDoc.Company(0))
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText( "Action Item: " & CurDoc.AISubject(0) )
Call rtitem.AddNewLine( 1 )
Set doc.CalendarDateTime = sdate
doc.Chair = NotesSession.UserName
doc.DocAuthors = NotesSession.UserName
Set doc.EndDate = edate
Set doc.EndDateTime = edate
Set doc.EndTime = edate
doc.ExcludeFromView = "D"
doc.Form = "Appointment"
doc.From = NotesSession.UserName
doc.ORGTABLE = "C0"
doc.Principal = NotesSession.UserName
doc.SequenceNum = 1
Set doc.StartDate = sdate
Set doc.StartDateTime = sdate
Set doc.StartTime = sdate
wsubject = "Action Item for " & CurDoc.Company(0)
doc.Subject = wsubject
Call doc.AppendItemValue("$PublicAccess","1")
Call doc.Save( False, False )
Print "Entry added to Calendar"
’ Else
’ Messagebox “Date must be filled in.”, 0, “Error”
’ End If
End If
End Sub