How to Add an attachment in Notes calendar using a button

Hi all,I’m creating a button to add an event in calendar notes.

How can I do in adding an attachment file inside the body (description) of calendar?

Here the lotusscript in the button:


Sub Click(Source As Button)

 ' **Scroll down to the "Change here" section to customize this button.

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim db As NotesDatabase     

Dim content As NotesRichTextItem

Dim note As NotesDocument, cnote As NotesDocument

Dim cSubject As String

Dim cBody As String

Dim date1 As NotesDateTime, date2 As NotesDateTime

Dim owner As NotesItem, item As NotesItem

Dim sendReply As Integer

' Updated 2005-10-03 to fix regional date format issue that caused incorrect date creation

Dim TimeZoneOffset As Integer

Dim startmonthnum As Integer, startdaynum As Integer, startyearnum As Integer

Dim starthournum As Integer, startminutenum As Integer

Dim endmonthnum As Integer, enddaynum As Integer, endyearnum As Integer

Dim endhournum As Integer, endminutenum As Integer



Set uidoc = ws.CurrentDocument

Set note = uidoc.Document

Set db = note.parentdatabase    

Set cnote  =  New NotesDocument (db)     

Set owner = note.GetFirstItem("Principal")



'****Start of calendar entry

'************************ Change things in this section  ***********************

'**** The first property you will set is the TimeZoneOffset of the appointment

'**** The TimeZoneOffset is the difference between the local time and Greenwich mean time for the date of the appointment

'****	For example, Eastern Standard time is -5 hours from GMT, while Eastern Daylight time is -4 hours from GMT.

'**** Check your local client to check your time zone

TimeZoneOffset = +1 '(Central European Time)



'**** The next properties you will set are the start date/time and end date/time of the appointment	

'**** Date/time fields:

'**** MonthNum: 1-12

'**** DayNum: 1-31

'**** YearNum: four digits, NOT two

'**** HourNum: 00-23 (military, or 24-hour) time; add 12 to an afternoon hour to get the military equivalent (1:00 PM is 13)

'**** MinuteNum: 00-59

StartMonthNum = 06	

StartDayNum = 23

StartYearNum = 2012

StartHourNum = 14	

StartMinuteNum = 00



EndMonthNum = 06

EndDayNum = 23	

EndYearNum = 2012	

EndHourNum = 15	

EndMinuteNum = 00



'**** The next field is the Subject which appears in the Calendar view

'**** Replace the text between the { } symbols below with the information you wish to include

'**** You may use multiple lines

cSubject = {GTO webcast edition- IBM Forum Centers Europe}



'**** The next field is the Detailed Description section of the calendar entry which does not appear in the Calendar view

'**** You can replace the text between the { } symbols, or delete it if no details are required

'**** You may use multiple lines

cBody = {		 		 		 		 

to be added here details about registrations info

}

'************************ End of Change Section ***********************



'build the NotesDateTime objects using the data entered above

Set date1 = ConvertNotesDateTime(startyearnum, startmonthnum, startdaynum, starthournum, startminutenum, timezoneoffset)

Set date2 = ConvertNotesDateTime(endyearnum, endmonthnum, enddaynum, endhournum, endminutenum, timezoneoffset)



 'This sets appointment fields

cnote.Subject = cSubject

cnote.Body =  cBody

cnote.AppointmentType = "0"

cnote.From = note.From

cnote.Form = "Appointment"

Call owner.CopyItemToDocument(cnote, "Principal")

Call owner.CopyItemToDocument(cnote, "Chair")



cnote.ExcludeFromView = "D"

cnote.Duration = 26

Call cnote.ReplaceItemValue("_ViewIcon", 9)

cnote.StartDateTime = date1.LSLocalTime

cnote.EndDateTime = date2.LSLocalTime

cnote.CalendarDateTime = date1.LSLocalTime

cnote.TimeRange = Timevalue(cnote.StartDateTime(0)) & "-" & _

Timevalue(cnote.EndDateTime(0))

cnote.ReminderTime = cnote.TimeRange(0)

Set item = New NotesItem(cNote, "$PublicAccess", "1")

Set item = New NotesItem(cNote, "$NoPurge", date2.LSLocalTime)

Set item = New NotesItem( cNote, "$BusyPriority", "1")

Set item = New NotesItem(cNote, "$BusyName", MailFileOwnerName(db))

cnote.save True, True

'****End of calendar entry



'** This code defines a note to be sent to someone as a response.  

'** Currently set to not send - change False to True below, and edit fields, to send

sendReply = True



If sendReply Then

	Dim rnote As NotesDocument	

	Dim rSendTo As String

	Dim rSubject As String

	Set rnote   = New NotesDocument(db)

	

' Edit the following two fields

	rSendTo = "Mariangela Arena/Italy/IBM" ' Notes name of desired recipient of response 

	rSubject = "I will Attend GTO Webcast meeting" ' subject line of response -- body will be blank

' End of editable section

	

	rnote.Form = "Memo"

	rnote.SendTo = rSendTo

	rnote.Subject = rSubject

	Call rnote.Send(True)

	Messagebox ("A response has been sent indicating you will attend.  Your calendar has been updated.")

Else

	Messagebox ("Your calendar has been updated.")

End If

End Sub


Could you help me? thanks

PS: I found this but I don’t know how to add it in the lotus script language above

Set notesEmbeddedObject = notesRichTextItem.EmbedObject( type%, class$, source$, [ name$ ]