Calendar Entry

Hello,

I tried following code for creating calendar entry in email recepient’s mail database.

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.Document

DocUNID = doc.STP_DocUNID(0)

url = “http://server.com/crm/salesprocess.nsf/0/” + DocUNID + “?OpenDocument”

ReminderAccountName = doc.STP_AccountName(0)

ReminderStrategy = doc.STP_StrategyTitle(0)

ReminderWho = doc.STP_Who(0)

ReminderDate = doc.STP_Date(0)

RTime = doc.STP_Time(0)

If RTime = “” Then

ReminderTime = “9:00:00 AM”

Else

ReminderTime = RTime

End If

FullDate = Str(ReminderDate) + " " + Str(ReminderTime) + " " + “ZE8”

Dim DateTime As New NotesDateTime(FullDate)

Dim IsTime As Variant

IsTime = DateTime.LSLocalTime

Dim session As New NotesSession

Dim user As String

user = session.CommonUserName

Dim dbnab As NotesDatabase

Dim view As notesview

Dim docnab As NotesDocument

Set dbnab = New NotesDatabase( “Spider”, “names.nsf” )

Set view = dbnab.GetView(“People”)

Set docnab = New notesdocument(dbnab)

Set docnab = view.getdocumentbykey(user)

If (docnab Is Nothing) Then

Print “No Matching Document”

Else

dbname = docnab.MailFile(0)

Set dbmailfile = New notesdatabase(“Spider”, dbname)

Set docnab = dbmailfile.CreateDocument

docnab.Form = “Appointment”

docnab.AppointmentType = “4”

docnab.Subject = ReminderStrategy + " - " + ReminderWho + " (" + ReminderAccountName + “)”

docnab.StartDate = IsTime

docnab.StartTime = IsTime

docnab.StartDateTime = IsTime

docnab.CalendarDateTime = IsTime

docnab.Principal = user

docnab.Body = "Please click on this link for more information : " + url

Call docnab.Save( True, True )

End If

End Sub

It works great, creates a calendar entry. But when I open a calendar entry I get following messages before the actual calendar entry opens up,

ErrorMsg1 : “Error tyring to open document: Note item not found”, user clicks OK button

ErrorMsg2 : “Note item not found” user clicks OK button, document opens up

ErrorMsg3 : “Object variable not set”

I debugged the script, but it comes from a script libraries from a mail file itself, which should not be modified. It looks like some of the default values gets set when calendar entry gets created.

Any idea how can I avoid this messages.

Thanks

MS

Subject: Analyze a manual calendar entry

Use the Notes Client to create a calendar entry in the usual way. Then, with the calendar entry unopened, use the Properties box to examine the values of the fields in the calendar entry. Make sure that you have these fields in the entry you generate from your script.

Subject: RE: Analyze a manual calendar entry

Thanks for your reply. When I am creating the calendar entry in R4 mail file, and open the calendar entry I don’t get any error message but If I create it on R6 mail file, I am getting all this errors.

Thanks

MS