1

This is my script. I wanted to have 2 dates and time in this script, so when some one clicks on the button there should be two entries in recipient calendar

i would really appreciate any help on this issue.

Sub Click(Source As Button)

    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim subject As String
    Dim maildoc As NotesDocument
    Dim rtitem As NotesRichTextItem
    Set db = s.CurrentDatabase
    Set doc = New NotesDocument(s.CurrentDatabase)
    Set maildoc = New NotesDocument(s.CurrentDatabase)
    Set ritem = New NotesRichTextItem(maildoc, "Body")

'Modify Subject, Location, Start Day and Time, End Day and Time before sending!!
'#########################################################################

    doc.subject = "test"
    doc.location = "bangalore"
    Set startdatetime = New NotesDateTime("03/26/2013 04:00:00 PM")
    Set enddatetime = New NotesDateTime("03/24/2008 05:00:00 PM")

'#########################################################################


    doc.From = s.UserName
    doc.Form = "Appointment"
    doc.AppointmentType = "0"
    doc.Chair = s.UserName
    doc.StartDateTime = startdatetime.LSLocalTime
    doc.EndDateTime = enddatetime.LSLocalTime
    doc.CalendarDateTime = startdatetime.LSLocalTime
    doc.TimeRange = Timevalue(doc.startdatetime(0)) & "-" & Timevalue(doc.enddatetime(0))
    doc.ExcludefromView = "D"

    Call doc.ReplaceItemValue("_ViewIcon", 160)
    Call doc.AppendItemValue("$BusyName", s.UserName)
    Call doc.AppendItemValue("$BusyPriority", "1")
    Call doc.AppendItemValue("$PublicAccess", "1")
    Call doc.save(True,True)

    Print "An entry for this event was successfully added to your calendar and an e-mail confirmation was sent."
    Msgbox "Calendar successfully updated and e-mail confirmation sent.", 64, "Success"

'Send e-mail confirmation

    maildoc.Form = "Memo"

'Modify Subject and Send to
'############################################################################

    maildoc.Subject = "test to send multiple emails"
    Dim recip(2) As Variant
    recip(0) = ""
    recip(1) = ""

    maildoc.sendto = recip

'############################################################################

    Call maildoc.Send(False)

End Sub
Manju Nath
  • 11
  • 1
  • 3
  • 1
    What's your question? What happens when you run this script now? – Ken Pespisa Mar 26 '13 at 13:15
  • Well the Script Works Fine..Once they click on the button whatever the Date and time Mentioned in the script goes to their calendar. What i want is to add two different dates in the script and also its should create two different entry in their calendar when clicks on it. – Manju Nath Mar 26 '13 at 13:21
  • Are you talking about creating a repeat appointment? I.e., the same time and same details, but on two different days? – Richard Schwartz Mar 26 '13 at 17:48
  • Yes you are right but different date and time on two different days.Even if its repeat appointment with same date and time,Details no problem That fine for me. But I want Two Entries in the calender.Thanks for checking this, I really appreciate your help thanks. – Manju Nath Mar 26 '13 at 19:47

2 Answers2

1

IBM has published the schema for Lotus Notes calendar appointments here. If you want to create a repeat appointment for two days, but at the same time of day on each day, then start on page 12. There are a lot of options, but I think you'll probably want to set Repeats="1", RepeatUnit="C" and set RepeatCustom = to an array with the two dates.

Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41
1

IBM moved the published Lotus Notes C&S Schema doc to here. The other link found above was the previous version that is not being updated.

In addition to adding an ORGRepeat value of "1", to make the entry repeat you need to have 3 parallel lists of values: StartDateTime, EndDateTime and RepeatInstanceDates. Initially the StartDateTime and RepeatInstanceDates items will contain the same values so you can simply the value once you create it.

The CalendarDateTime item also needs to have the same number of values that the lists above do so that the entry will display at the right dates/times on the Calendar.

One potential problem w/you script is that it will use the users timezone for the times. So if any user is in another time zone and they click on it, the entries will be put at the wrong time. You can fix that by putting the 3 character timezone identifier at the end of your values (e.g. "03/26/2013 04:00:00 PM EDT")

You may also want to take a look at the button script I found here for another example of how to do it.

Bruce Kahn
  • 71
  • 2