Habe in der Sandbox einen EventKalender gefunden, welchen ich eine bisschen modifiziert habe und gerne bei uns im Marketing einsetzen würde.
Hier ist eine Aktion vorhanden, welche nicht wirklich funktioniert.
Man kann erstellte Termine durch anklicken eines Aktionsbuttons in seinen eigenen Kalender übernehmen.
Die Syntax lautet:
Sub Click(Source As Button)
Dim db As Notesdatabase
Dim session As New NotesSession
Dim workspace As New notesuiworkspace
Dim uidoc As notesuidocument
Dim note As notesdocument
Dim item As NotesItem
Dim startdttm As NotesDateTime
Dim enddttm As NotesDateTime
Dim window As NotesDateRange
Dim names As String
Dim dur As Integer
Dim username As String
Set uidoc = workspace.currentdocument
Set note = uidoc.Document
Set item = note.GetFirstItem("EventStartDate")
Set startdttm = item.DateTimeValue
Set item = note.GetFirstItem("EventEndDate")
Set enddttm = item.DateTimeValue
Set window = session.CreateDateRange()
Set window.StartDateTime = startdttm
Set window.EndDateTime = enddttm
names = session.CommonUserName
dur = ((enddttm.TimeDifference(startdttm))+86400)/60
freeTime = session.FreeTimeSearch(window, dur, names, True)
' If there is no value for freeTime(0) then that time is already booked - messagebox constants 0=okonly, 4=yesno, 32=question mark icon, 7=no
' If (freeTime(0) Is Nothing) Then
' If Messagebox ("This time is already booked - do you want to double book?", 4 + 32) = 7 Then
' Messagebox "This document has NOT been added to your calendar. ", 0, "Add Canceled"
' Exit Sub
' End If
' End If
Set db = New notesdatabase("", "")
Call db.openmail
Dim cEntry As New NotesDocument(db)
Dim rtitem As Variant
Dim itemIcon As NotesItem
username = session.UserName
cEntry.From = note.From(0)
cEntry.Subject = note.EventDescription
Set rtitem = note.GetFirstItem("Body")
Call rtitem.CopyItemToDocument(cEntry, "Body")
cEntry.Form = "Appointment"
cEntry.AppointmentType = "2"
cEntry.tmpWasMailed = "1"
cEntry.ExcludeFromView = "D"
cEntry.OrgTable = "P0"
cEntry.Location = note.Location
cEntry.calendarDateTime = note.datelist
Set itemIcon = New NotesItem(cEntry, "_ViewIcon", 9)
itemIcon.IsSummary = True
cEntry.Logo = "stdNotesLtr0"
cEntry.StartDate = note.EventStartDate
cEntry.EndDate = note.EventEndDate
Call cEntry.save(True, True)
Messagebox "This document has been added to your calendar. ", 0, "Add Complete"
End Sub
In der Ansicht alle Dokumente ist der Eintrag dann vorhanden, jedoch nicht im Kalender. Man kann die Dokumente auch nicht öffnen.
Fehlermeldungen lauten: