I have an agent that sends out a meeting notice to users. The problem is that when eacj user gets the meeting notice emailed to them, it is automatically added to their calendar without having them accept/decline it. Then if the user declines the meeting, the meeting notice is not removed from the calendar view.
I assume there is some field that is not being updated when the user hits decline??
Here is the code of the agent:
Sub Initialize
Dim ws As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As New NotesDatabase("","")
Dim doc As NotesDocument, doc As NotesDocument, invitedoc As NotesDocument
Call db.OpenMail
Set doc = ws.CurrentDocument.Document
Set cdoc = db.CreateDocument
Call cdoc.ReplaceItemValue("Form","Appointment")
Call cdoc.ReplaceItemValue("AppointmentType", "3")
Call cdoc.ReplaceItemValue("_ViewIcon", 158)
Call cdoc.ReplaceItemValue("Chair", doc.Name)
Call cdoc.ReplaceItemValue("Principal", "ASG Toyota Event Calendar")
Call cdoc.ReplaceItemValue("Subject",doc.Description(0))
Call cdoc.ReplaceItemValue("Topic", doc.Description(0))
Call cdoc.ReplaceItemValue("Location", doc.SSNAArea(0))
Call cdoc.ReplaceItemValue("SequenceNum",1)
’ //read the datetime from the edstartdate field that user has typed in=
Dim d1 As NotesDateTime
Dim item As NotesItem
Set item = doc.GetFirstItem("StartDateTime")
Set d1 = item.DateTimeValue
Set domDateTime = s.CreateDateTime("" & d1.DateOnly & " " & d1.TimeOnly)
Call cdoc.ReplaceItemValue("CalendarDateTime", domDateTime.LSLocalTime)
Call cdoc.ReplaceItemValue("StartTime", domDateTime.LSLocalTime)
Call cdoc.ReplaceItemValue("StartDate",domDateTime.LSLocalTime)
Call cdoc.ReplaceItemValue("StartDateTime", domDateTime.LSLocalTime)
'//read the datetime from the edenddate field that user has typed in
Dim d2 As NotesDateTime
Set item = doc.GetFirstItem("EndDateTime")
Set d2 = item.DateTimeValue
Set domDateTime = s.CreateDateTime("" & d2.DateOnly & " " & d2.TimeOnly)
Call cdoc.ReplaceItemValue("EndDateTime", domDateTime.LSLocalTime)
Call cdoc.ReplaceItemValue("EndDate",domDateTime.LSLocalTime)
Call cdoc.ReplaceItemValue("EndTime",domDateTime.LSLocalTime)
Set ntitem = doc.ReplaceItemValue("ExcludeFromView", "D")
Call ntitem.AppendToTextList( "S" )
'Names from Address Book
'Dim sendTo As Variant
'Dim tempnamesdoc As NotesDocument
'Set tempnamesdoc = doc.Document
'sendTo = tempnamesdoc.tempnames
Call cdoc.ReplaceItemValue("RequiredAttendees", "Derek A Etnyre/NA/Johnson_Controls")
Call cdoc.ReplaceItemValue("SendTo","Derek A Etnyre/NA/Johnson_Controls")
Call cdoc.ReplaceItemValue("CopyTo", "")
Call cdoc.ReplaceItemValue("BlindCopyTo", "")
Call domDateTime.SetNow
Call cdoc.ReplaceItemValue( "PostedDate", domDateTime.LSLocalTime )
Call cdoc.ReplaceItemValue( "EnterSendTo", "" )
Call cdoc.ReplaceItemValue( "EnterCopyTo", "" )
Call cdoc.ReplaceItemValue( "EnterBlindCopyTo", "" )
Call cdoc.ReplaceItemValue( "$CSTrack", "Sent" )
Call cdoc.ReplaceItemValue( "$Mailer", "LN" )
Call cdoc.ReplaceItemValue( "$MessageID", "automatic@Localdomain" )
'Call cdoc.save(True, True, True)
Call cdoc.Send(False)