Hallo
wnn jemand dafür Interesse hat, das Problem mit der Erstellung eines Termins in der Notes Calender von einer Anwendung aus, habe ich auf folgende Weise glöst:
ich habe die Backend und Frontend susammen verwendet (s. Script unten) trotz der Warnung von Bernhard (er sagte mal, dass entweder in Backend oder in Frontend programmiert werden sollte, aber kann sein, dass ich ihn falsch verstanden habe ).
Also, jetzt funktioniert alles einwandfrei
Dim ws As NotesUIWorkspace
Dim s As NotesSession
Dim db As NotesDatabase
Dim uidb As NotesDatabase
Dim uiDocA As NotesUIDocument
Dim docA As NotesDocument
Dim uiDocM As NotesUIDocument
Dim docM As NotesDocument
Dim tmpSRV As String
Dim tmpMAIL As String
Dim AnfangD As Variant
Dim EndeD As Variant
Dim AnfangZ As String
Dim EndeZ As String
Dim Einlad As Variant
Dim tmpBody As Variant
Dim tmpOrt As String
Dim tmpSubject As String
Dim tmpDokuTitel As String
Dim tmpKundenName As String
Dim rtitem As NotesRichTextItem
Dim tmpAutor As String
Dim nid As String
Dim itemTo As NotesItem
Dim tmpAppointmentType As String
Sub Click(Source As Button)
Set s = New NotesSession
Set ws = New NotesUIWorkspace
Set uidb = s.CurrentDatabase
Set uiDocA = ws.CurrentDocument
Call uiDocA.Refresh
Call uiDocA.Save
Set docA = uiDocA.Document
tmpAutor = uiDocA.FieldGetText("Autor")
AnfangD = uiDocA.FieldGetText("StartDate")
EndeD = uiDocA.FieldGetText("StartDate")
AnfangZ = Strleft(uiDocA.FieldGetText("TimeRange"), "-")
EndeZ = Strright(uiDocA.FieldGetText("TimeRange"), "-")
tmpOrt = uiDocA.FieldGetText("Ort")
tmpBody = uiDocA.FieldGetText("DokuBeschreibung")
tmpDokuTitel = uiDocA.FieldGetText("DokuTitel")
tmpKundenName = uiDocA.FieldGetText("KundenName")
tmpSubject = tmpKundenName & " -> " & tmpDokuTitel
tmpSRV = uiDocA.FieldGetText("srv_1")
tmpMAIL = uiDocA.FieldGetText("MailDatei")
Einlad = uiDocA.FieldGetText("SendTo")
Set db = New NotesDatabase( tmpSRV, tmpMAIL )
If Einlad = "" Then
tmpAppointmentType = "0"
Else
tmpAppointmentType = "3"
End If
Call MailSenden()
If uiDocA.FieldGetText("Anreisezeit") <> "" Then
tmpSubject = "Anreisezeit -> " & tmpKundenName & " -> " & tmpDokuTitel
AnfangZ = Strleft(uiDocA.FieldGetText("Anreisezeit"), "-")
EndeZ = Strright(uiDocA.FieldGetText("Anreisezeit"), "-")
If uiDocA.FieldGetText("RZbuchen") = "" Then
Einlad = ""
tmpAppointmentType = "0"
End If
Call MailSenden()
End If
If uiDocA.FieldGetText("Abreisezeit") <> "" Then
tmpSubject = "Abreisezeit -> " & tmpKundenName & " -> " & tmpDokuTitel
AnfangZ = Strleft(uiDocA.FieldGetText("Abreisezeit"), "-")
EndeZ = Strright(uiDocA.FieldGetText("Abreisezeit"), "-")
If uiDocA.FieldGetText("RZbuchen") = "" Then
Einlad = ""
tmpAppointmentType = "0"
End If
Call MailSenden()
End If
End Sub
Function MailSenden()
Set uiDocM = ws.composeDocument(tmpSRV, tmpMAIL, "Appointment",4,4)
Call uiDocM.FieldSetText("AppointmentType", tmpAppointmentType)
Call uiDocM.Refresh
Call uiDocM.FieldSetText("EnterSendTo", Einlad)
Call uiDocM.FieldSetText("StartDate", AnfangD)
Call uiDocM.FieldSetText("EndDate", EndeD)
Call uiDocM.FieldSetText("StartTime", AnfangZ)
Call uiDocM.FieldSetText("EndTime", EndeZ)
Call uiDocM.FieldSetText("Subject", tmpSubject)
Call uiDocM.FieldSetText("Location", tmpOrt)
Call uiDocM.FieldSetText("Body", tmpBody)
Set docM = uiDocM.Document
Set rtitem = New NotesRichTextItem( docM, "Body" )
Call rtitem.AppendText( tmpBody )
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText( "Dokumentverknüpfung: " )
Call rtitem.AppendDocLink ( docA, tmpSubject )
docM.RepeatStartDate = Cdat(AnfangD)
docM.StartDateTime =Cdat(AnfangD & " " & AnfangZ)
docM.EndDateTime =Cdat(EndeD & " " & EndeZ)
docM.StartDate = Cdat(AnfangD)
docM.EndDate = Cdat(EndeD)
docM.StartTime =Cdat(AnfangZ)
docM.EndTime = Cdat(EndeZ)
docM.EnterSendTo = Einlad
docM.Subject = tmpSubject
docM.Location = tmpOrt
docM.Body = tmpBody
Call docM.Save( True, True )
uiDocM.Reload
Call uiDocM.Save
uiDocM.Close
End Function
Weiss nicht, wie soll ich markieren, dass die Thema gelöst ist ?
Gruessen
Sofia