Hello. I have a problem creating appointments in Outlook with vb.net.
Let see... i create the 1º and i see it in my calendar.
When i creat the 2º, the 1º deseapear and the 2º appear.
When i creat the 3º, the 2º deseapear and the 3º appear.
Can you help me please with my trouble¿?
For Me.i = 0 To myDataSet.Tables(0).Rows.Count - 1
objOutlook = New Outlook.Application()
objNS = objOutlook.Session
objFolder = objNS.Folders.Item("xavier.portales@sage.com")
objFolder = objFolder.Folders.Item("Calendario")
objApp = CType(objFolder.Items.Item(Outlook.OlItemType.olAppointmentItem), Outlook.AppointmentItem)
WriteOutlook()
Next
------------------------------------------------
Private Sub WriteOutlook()
DBegin = myDataSet.Tables(0).Rows(i).Item(2)
DEnd = myDataSet.Tables(0).Rows(i).Item(3)
HBegin = Format(CDbl(myDataSet.Tables(0).Rows(i).Item(6)), "F")
HBegin = Replace(HBegin, ",", ":")
HEnd = Format(CDbl(myDataSet.Tables(0).Rows(i).Item(7)), "F")
HEnd = Replace(HEnd, ",", ":")
FechaIni = DBegin.ToString("dd.MM.yyyy") & " " & HBegin
FechaEnd = DEnd.ToString("dd.MM.yyyy") & " " & HEnd
Ident = ""
tPosicion = ""
With (objApp)
.Subject = myDataSet.Tables(0).Rows(i).Item(1)
.Location = ""
.Body = myDataSet.Tables(0).Rows(i).Item(1)
.Body = .Body & " - " & myDataSet.Tables(0).Rows(i).Item(5)
.Start = CDate(FechaIni)
.End = CDate(FechaEnd)
.ReminderMinutesBeforeStart = 15
.ReminderSet = True
'.RequiredAttendees = Environment.UserName
.Save()
'.Send()
cmdGetApptsInTimeFrame_Click(CDate(FechaIni), CDate(FechaEnd))
End With
If Not objApp Is Nothing Then Marshal.ReleaseComObject(objApp)
objApp = Nothing
objOutlook = Nothing
objNS = Nothing
objFolder = Nothing
End Sub