| Public Function SendNotesTermin(pstrSubject As String, _ |
| pstrRecipient As String, _ |
| pstrMailBody As String, _ |
| AppDate As Date, _ |
| StartTime As Date, _ |
| MinsDuration As Integer, _ |
| pstrLocation As String, _ |
| pstrCategories As String, _ |
| AppointmentType As String) As String |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| On Error GoTo proc_error |
| |
| Dim objNotesSession As Object |
| Dim objNotesDatabase As Object |
| Dim objNotesDocument As Object |
| Dim objItem As Object |
| Dim strServerName As String |
| Dim strServerEinzelname() As String |
| Dim strMailDbName As String |
| Dim strUserName As String |
| Dim strUserEinzelname() As String |
| Dim strUserMail As String |
| Dim datStart As Date |
| Dim datEnde As Date |
| Dim intZaehler As Integer |
| Dim dblAnzahlTage As Double |
| Dim strCSTrack(2) As String |
| Dim intAnzahlEmpfaenger As Integer |
| Dim strStorageRequiredNames() As String |
| |
| |
| SendNotesTermin = "" |
| |
| |
| If AppointmentType = 2 Then |
| datStart = CDate(AppDate & " " & "04:00") |
| dblAnzahlTage = fktAufrunden(MinsDuration / 60 / 24, 0) |
| datEnde = CDate(Format(DateAdd("d", dblAnzahlTage - 1, datStart), "dd.mm.yyyy") & " 22:00") |
| Else |
| datStart = CDate(AppDate & " " & Format(StartTime, "hh:mm")) |
| datEnde = DateAdd("n", MinsDuration, datStart) |
| End If |
| |
| Set objNotesSession = CreateObject("Notes.NotesSession") |
| |
| strUserName = objNotesSession.UserName |
| strUserMail = Replace(Replace(Replace(strUserName, "CN=", ""), "OU=", ""), "O=", "") |
| strServerName = objNotesSession.GETENVIRONMENTSTRING("MailServer", True) |
| strMailDbName = objNotesSession.GETENVIRONMENTSTRING("MailFile", True) |
| |
| strServerEinzelname = Split(Replace(Replace(Replace(strServerName, "CN=", ""), "OU=", ""), "O=", ""), "/") |
| strUserEinzelname = Split(Replace(Replace(Replace(strUserName, "CN=", ""), "OU=", ""), "O=", ""), "/") |
| |
| Set objNotesDatabase = objNotesSession.GETDATABASE(strServerName, strMailDbName) |
| Set objNotesDocument = objNotesDatabase.CREATEDOCUMENT |
| |
| With objNotesDocument |
| |
| |
| .APPTUNID = objNotesDocument.UNIVERSALID |
| |
| |
| .REPLACEITEMVALUE "Form", "Appointment" |
| .REPLACEITEMVALUE "AppointmentType", AppointmentType |
| |
| |
| |
| .REPLACEITEMVALUE "Categories", pstrCategories |
| .REPLACEITEMVALUE "Location", pstrLocation |
| .REPLACEITEMVALUE "Subject", pstrSubject |
| .REPLACEITEMVALUE "Body", pstrMailBody |
| |
| |
| .REPLACEITEMVALUE "Chair", objNotesSession.UserName |
| .REPLACEITEMVALUE "AltChair", objNotesSession.UserName |
| .REPLACEITEMVALUE "From", objNotesSession.UserName |
| Set objItem = .GETFIRSTITEM("From") |
| objItem.ISNAMES = True |
| objItem.ISAUTHORS = True |
| Set objItem = Nothing |
| .REPLACEITEMVALUE "Principal", objNotesSession.UserName |
| .REPLACEITEMVALUE "$AltPrincipal", objNotesSession.UserName |
| |
| |
| .REPLACEITEMVALUE "$Alarm", 1 |
| .REPLACEITEMVALUE "$AlarmOffset", -15 |
| .REPLACEITEMVALUE "Alarms", "1" |
| |
| |
| Select Case AppointmentType |
| Case 0 |
| .REPLACEITEMVALUE "_ViewIcon", 160 |
| .REPLACEITEMVALUE "$IconSwitcher", "Appointment" |
| Case 1 |
| .REPLACEITEMVALUE "_ViewIcon", 63 |
| .REPLACEITEMVALUE "$IconSwitcher", "Anniversary" |
| Case 2 |
| .REPLACEITEMVALUE "_ViewIcon", 9 |
| .REPLACEITEMVALUE "$IconSwitcher", "AllDayEvent" |
| Case 3 |
| .REPLACEITEMVALUE "_ViewIcon", 158 |
| .REPLACEITEMVALUE "$IconSwitcher", "Meeting" |
| Case 4 |
| .REPLACEITEMVALUE "_ViewIcon", 10 |
| .REPLACEITEMVALUE "$IconSwitcher", "Reminder" |
| End Select |
| |
| |
| .REPLACEITEMVALUE "StartDateTime", datStart |
| .REPLACEITEMVALUE "EndDateTime", datEnde |
| .REPLACEITEMVALUE "StartDate", datStart |
| .REPLACEITEMVALUE "StartTime", datStart |
| .REPLACEITEMVALUE "EndDate", datEnde |
| .REPLACEITEMVALUE "EndTime", datEnde |
| .REPLACEITEMVALUE "$NoPurge", datEnde |
| |
| If AppointmentType = 2 Then |
| |
| Dim arrCalenderDateTime() As Date |
| ReDim arrCalenderDateTime(dblAnzahlTage - 1) |
| For intZaehler = 0 To dblAnzahlTage - 1 |
| arrCalenderDateTime(intZaehler) = DateAdd("d", intZaehler, datStart) |
| Next |
| .REPLACEITEMVALUE "CalendarDateTime", arrCalenderDateTime |
| |
| Else |
| |
| .REPLACEITEMVALUE "CalendarDateTime", datStart |
| |
| End If |
| |
| |
| |
| If AppointmentType = 3 Then |
| |
| Dim arrRequiredAttendeeName() As String |
| arrRequiredAttendeeName = Split(pstrRecipient, ",") |
| |
| For intZaehler = 0 To UBound(arrRequiredAttendeeName) |
| |
| If Trim(arrRequiredAttendeeName(intZaehler)) = strUserMail Then |
| arrRequiredAttendeeName(intZaehler) = vbNullString |
| Else |
| arrRequiredAttendeeName(intZaehler) = Trim(arrRequiredAttendeeName(intZaehler)) |
| End If |
| Next |
| |
| .REPLACEITEMVALUE "Recipients", arrRequiredAttendeeName |
| .REPLACEITEMVALUE "RequiredAttendees", arrRequiredAttendeeName |
| |
| .REPLACEITEMVALUE "SendTo", arrRequiredAttendeeName |
| Set objItem = .GETFIRSTITEM("SendTo") |
| objItem.ISNAMES = True |
| objItem.ISSIGNED = True |
| Set objItem = Nothing |
| |
| |
| intAnzahlEmpfaenger = UBound(arrRequiredAttendeeName) |
| ReDim strStorageRequiredNames(intAnzahlEmpfaenger) |
| |
| For intZaehler = 0 To intAnzahlEmpfaenger |
| strStorageRequiredNames(intZaehler) = "1" |
| Next |
| .REPLACEITEMVALUE "StorageRequiredNames", strStorageRequiredNames |
| Set objItem = .GETFIRSTITEM("StorageRequiredNames") |
| objItem.ISNAMES = True |
| Set objItem = Nothing |
| |
| .REPLACEITEMVALUE "$CSVersion", "2" |
| .REPLACEITEMVALUE "$CSWISL", Array("$S:1", "$L:1", "$B:1", "$R:1", "$E:1", "$W:1", "$O:1", "$M:1") |
| .REPLACEITEMVALUE "$WatchedItems", Array("$S", "$L", "$B", "$R", "$E", "$W", "$O", "$M") |
| |
| strCSTrack(0) = "Send[" & strServerEinzelname(0) & "] by Notes on " & strUserEinzelname(0) & "(" & objNotesSession.NOTESVERSION & ") at " & Format(Now(), "DD.MM.YYYY HH:MM:SS") |
| strCSTrack(1) = "PrepareToSend[" & strServerEinzelname(0) & "] by Notes on " & strUserEinzelname(0) & "(" & objNotesSession.NOTESVERSION & ") at " & Format(Now(), "DD.MM.YYYY HH:MM:SS") |
| strCSTrack(2) = "Restore[" & strServerEinzelname(0) & "] by Notes on " & strUserEinzelname(0) & "(" & objNotesSession.NOTESVERSION & ") at " & Format(Now(), "DD.MM.YYYY HH:MM:SS") |
| .REPLACEITEMVALUE "$CSTrack", strCSTrack |
| |
| .REPLACEITEMVALUE "$TableSwitcher", "Description" |
| .REPLACEITEMVALUE "NoticeType", "I" |
| |
| End If |
| |
| |
| .REPLACEITEMVALUE "$BusyName", strUserName |
| Set objItem = .GETFIRSTITEM("$BusyName") |
| objItem.ISNAMES = True |
| Set objItem = Nothing |
| .REPLACEITEMVALUE "BookFreeTime", "" |
| .REPLACEITEMVALUE "$BusyPriority", "1" |
| |
| |
| .REPLACEITEMVALUE "$UpdatedBy", objNotesSession.UserName |
| .REPLACEITEMVALUE "OrgTable", "C0" |
| .REPLACEITEMVALUE "$PublicAccess", "1" |
| .REPLACEITEMVALUE "StartTimeZone", "Z=-1$DO=1$DL=3 -1 1 10 -1 1$ZX=86$ZN=W. Europe" |
| .REPLACEITEMVALUE "$ExpandGroups", "3" |
| |
| .REPLACEITEMVALUE "$FromPreferredLanguage", "de" |
| .REPLACEITEMVALUE "$LangChair", "" |
| .REPLACEITEMVALUE "$SMTPKeepNotesItem", "1" |
| |
| .REPLACEITEMVALUE "UpdateSeq", 1 |
| .REPLACEITEMVALUE "WebDateTimeInit", "1" |
| |
| .REPLACEITEMVALUE "ExcludeFromView", Array("S", "D") |
| .REPLACEITEMVALUE "MailOptions", "" |
| |
| .REPLACEITEMVALUE "Resources", "" |
| .REPLACEITEMVALUE "Repeats", "" |
| .REPLACEITEMVALUE "RoomToReserve", "" |
| |
| |
| |
| If .COMPUTEWITHFORM(True, False) = False Then |
| MsgBox "Bei der Erstellung des Termins ist ein Fehler aufgetreten!" |
| GoTo proc_exit |
| End If |
| |
| |
| If AppointmentType = 3 Then |
| .SAVEMESSAGEONSEND = False |
| .SIGNONSEND = True |
| |
| |
| .REPLACEITEMVALUE "Form", "Notice" |
| .REPLACEITEMVALUE "_ViewIcon", 133 |
| .REPLACEITEMVALUE "ExcludeFromView", Array("A") |
| Set objItem = .GETFIRSTITEM("$BusyPriority") |
| objItem.Remove |
| Set objItem = Nothing |
| Set objItem = .GETFIRSTITEM("CalendarDateTime") |
| objItem.Remove |
| Set objItem = Nothing |
| |
| |
| .SEND False |
| |
| |
| .REPLACEITEMVALUE "Form", "Appointment" |
| .REPLACEITEMVALUE "_ViewIcon", 158 |
| .REPLACEITEMVALUE "ExcludeFromView", Array("S", "D") |
| .REPLACEITEMVALUE "$BusyPriority", "1" |
| .REPLACEITEMVALUE "CalendarDateTime", datStart |
| |
| |
| |
| Set objItem = .GETFIRSTITEM("SendTo") |
| objItem.Remove |
| Set objItem = Nothing |
| Set objItem = .GETFIRSTITEM("NoticeType") |
| objItem.Remove |
| Set objItem = Nothing |
| |
| End If |
| |
| |
| .Save True, False |
| |
| |
| .PUTINFOLDER "$Alarms", True |
| |
| End With |
| |
| |
| proc_exit: |
| Set objNotesDocument = Nothing |
| Set objNotesDatabase = Nothing |
| Set objNotesSession = Nothing |
| Exit Function |
| |
| proc_error: |
| SendNotesTermin = Err.Description |
| Resume proc_exit |
| |
| End Function |
| |
| Public Function fktAufrunden(Zahl As Double, Stellen As Integer) As Double |
| |
| If IsNull(Zahl) = True Then |
| fktAufrunden = 0 |
| Else |
| Zahl = CDec(Zahl) |
| If ((Zahl - Int(Zahl)) * 10 ^ Stellen) = 0 Then |
| fktAufrunden = Int(Zahl) + (Int(((Zahl - Int(Zahl)) * 10 ^ Stellen)) / 10 ^ Stellen) |
| Else |
| fktAufrunden = Int(Zahl) + (Int(((Zahl - Int(Zahl)) * 10 ^ Stellen) + 1) / 10 ^ Stellen) |
| End If |
| End If |
| |
| End Function |