| Sub Initialize |
| |
| Dim session As New NotesSession |
| Dim ws As New NotesUIWorkspace |
| Dim collection As NotesDocumentCollection |
| Dim currentdb As NotesDatabase |
| Dim maildb As NotesDatabase |
| Dim profile As NotesDocument |
| Dim doc As NotesDocument |
| Dim wvdoc As NotesDocument |
| Dim datetime As New NotesDateTime("") |
| Dim dateitem As NotesItem |
| Dim timeitem As NotesItem |
| Dim MailDatenbank As Variant |
| Dim eintrag As String |
| |
| |
| 'Initialisierung mit aktuellen Datum und Uhrzeit |
| Call datetime.SetNow |
| |
| ' Zugriff auf markiertes Dockument |
| Set currentdb = session.CurrentDatabase |
| Set collection = currentdb.UnprocessedDocuments |
| If collection.Count = 0 Then |
| Messagebox "Sie haben keinen Eintrag markiert.", 64, "Adressen" |
| Exit Sub |
| End If 'If collection.Count = 0 |
| If collection.Count = 1 Then |
| Set doc = collection.GetNthDocument(1) |
| If doc.Form(0) = "frmFirma" Then |
| eintrag = Trim$(doc.Vorname(0) & " " & doc.Name(0)) |
| Else |
| eintrag = Trim$(doc.KontaktVorname(0) & " " & doc.KontaktName(0)) |
| End If 'If doc.Form(0) = "frmFirma" |
| Else |
| Messagebox "Für die Erstellung einer Wiedervorlage darf nur ein Eintrag markiert sein.", 64, "Adressen" |
| Exit Sub |
| End If 'If collection.Count = 1 |
| |
| 'Zugriff auf Maildatenbank und Prüfung ob im Kalenderprofil die Weckfunktion eingeschaltet ist. |
| MailDatenbank = Evaluate("@MailDbName") |
| If MailDatenbank(1) = "" Then |
| Messagebox "Auf Ihre Maildatenbank kann nicht zugegriffen werden.", 16, "Adressen - Fehler" |
| Exit Sub |
| End If 'If MailDatenbank(1) = "" |
| Set maildb = New NotesDatabase(MailDatenbank(0),MailDatenbank(1)) |
| Set profile = maildb.GetProfileDocument("CalendarProfile") |
| If profile Is Nothing Then |
| Messagebox "Fehler beim Zugriff aus das Kalenderprofil Ihrer Maildatenbank.", 16, "Adressen - Fehler" |
| Exit Sub |
| Else |
| If profile.EnableAlarms(0) <> "1" Then |
| Messagebox "Im Kalenderprofil Ihrer Maildatenbank sind keine Alarmoptionen aktiviert." & Chr$(10) & _ |
| "Es kann keine Wiedervorlage erstellt werden.", 48, "Adressen - Warnung" |
| Exit Sub |
| End If ' If profile.EnableAlarms(0) <> "1" |
| End If 'If profile Is Nothing |
| |
| 'Erstellen einer Erinnerung innerhalb der Maildatenbank des Users |
| Set wvdoc = New NotesDocument(maildb) |
| wvdoc.Form = "Appointment" |
| wvdoc.AppointmentType = "4" |
| wvdoc.ExcludeFromView = "D" |
| Set wvdoc.StartDateTime = datetime |
| Set wvdoc.CalendarDateTime = datetime |
| wvdoc.Subject = "Wiedervorlage für " & eintrag |
| |
| If ws.DialogBox("tmDlgAlarm", True, True, False, False, False, False, "Wiedervorlage", wvdoc) = False Then Exit Sub |
| |
| Set dateitem = wvdoc.GetFirstItem("tmpAlarmOnDate") |
| Set timeitem = wvdoc.GetFirstItem("tmpAlarmOnTime") |
| Set AlarmTime = New NotesDateTime(dateitem.DateTimeValue.DateOnly & " " & timeitem.DateTimeValue.TimeOnly) |
| Set wvdoc.ReminderTime = AlarmTime |
| Set wvdoc.StartDateTime = AlarmTime |
| Set wvdoc.CalendarDateTime = AlarmTime |
| Set wvdoc.~$AlarmTime = AlarmTime |
| Call wvdoc.ReplaceItemValue("$Alarm", 1) |
| AlarmSet = 1 |
| wvdoc.RemoveItem("$AlarmOffset") |
| Call wvdoc.ReplaceItemValue("_ViewIcon",10) |
| wvdoc.OrgDontDoubleBook = "" |
| wvdoc.OrgTable = ORS_ITEM_CALENDAR |
| wvdoc.~$PublicAccess = "0" 'Allgemeinen Zugriff verhindern |
| |
| Call wvdoc.ComputeWithForm(True,False) |
| Call wvdoc.Save(True,False,True) 'Sichern und als gelesen markieren |
| Call wvdoc.PutInFolder("$Alarms") 'Damit autom. Benachrichtigung erfolgt in entspr. Ordner kopieren |
| |
| 'Hier übernimmst du die Daten in dein Dokument (Feldnamen beispielhaft) |
| doc.WiedervorlageDatum = wvdoc.StartDateTime |
| doc.WiedervorlageZeit = AlarmTime |
| Call doc.Save(True,False) |
| |
| End Sub |