hallo leute
muss für die firma, die geburtstage der mitarbeiter ins outlook eintragen.
mein code funktioniert eigentlich ganz gut, aussert dass die termine nicht ganztägig eingetragen werden.
kann mir jemand helfen, die lösung zu finden?
geburtstage.ini
vielen dank im voraus.
grüsse
gianni27
muss für die firma, die geburtstage der mitarbeiter ins outlook eintragen.
mein code funktioniert eigentlich ganz gut, aussert dass die termine nicht ganztägig eingetragen werden.
kann mir jemand helfen, die lösung zu finden?
VB.NET-Quellcode
- Imports System.Reflection
- Public Class Form1
- Private Declare Unicode Function GetPrivateProfileString Lib "kernel32" _
- Alias "GetPrivateProfileStringW" (ByVal lpApplicationName As String, _
- ByVal lpKeyName As String, ByVal lpDefault As String, _
- ByVal lpReturnedString As String, ByVal nSize As Int32, _
- ByVal lpFileName As String) As Int32
- Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
- newAppointment()
- End Sub
- Sub newAppointment()
- Dim ini As String = "geburtstage.ini"
- Dim oItem() As String
- Dim anzahlItem As Integer
- anzahlItem = INIRead(ini, "Geburtstage", "Anzahl Feiertage", "")
- For i = 1 To anzahlItem
- Dim myOLApp As Object
- Dim myItem As Object
- myOLApp = CreateObject("Outlook.Application")
- myItem = myOLApp.CreateItem(1)
- Dim myPattern = myItem.GetRecurrencePattern
- Dim initext = INIRead(ini, "Geburtstage", "Geburtstag" & i, "")
- oItem = Split(initext, ",")
- With myItem
- .Subject = oItem(0)
- .BusyStatus = oItem(5)
- .ReminderMinutesBeforeStart = 0
- .ReminderSet = False
- End With
- With myPattern
- .RecurrenceType = 5
- .PatternStartDate = oItem(1)
- .PatternEndDate = oItem(2)
- End With
- myItem.Save()
- myOLApp = Nothing
- myItem = Nothing
- myPattern = Nothing
- Next
- MsgBox("Geburtstage erfolgreich hinzugefügt")
- End Sub
- Public Overloads Function INIRead(ByVal INIPath As String, _
- ByVal SectionName As String, ByVal KeyName As String, _
- ByVal DefaultValue As String) As String
- ' primary version of call gets single value given all parameters
- Dim n As Int32
- Dim sData As String
- sData = Space$(1024) ' allocate some room
- n = GetPrivateProfileString(SectionName, KeyName, DefaultValue, _
- sData, sData.Length, INIPath)
- If n > 0 Then ' return whatever it gave us
- INIRead = sData.Substring(0, n)
- Else
- INIRead = ""
- End If
- End Function
- End Class
geburtstage.ini
vielen dank im voraus.
grüsse
gianni27