Bonjour,
Je voudrais pouvoir ajouter un rendez-vous dans le calendrier d'Outlook par une appli créée en VB.NET
Voici le code :
Problème j'ai une indication d'erreur pour la ligne :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 Private Sub Button_OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_OK.Click Try Dim objOutlook As Outlook.Application Dim objAppt As Outlook.AppointmentItem Dim olns As Outlook.NameSpace Dim MycalendarFolder As Outlook.MAPIFolder Dim MyFolder As Outlook.Items objOutlook = CreateObject("Outlook.Application") olns = objOutlook.GetNamespace("MAPI") MycalendarFolder = olns.GetDefaultFolder(olFolderCalendar) 'Selectionne le calendrier 'Selectionne le calendrier MyFolder = MycalendarFolder.Items objAppt = MyFolder.Add 'Cree le rendez vous With objAppt .Start = DateTimePickerDébut.Value .Duration = 30 .Subject = TextBox_Sujet.Text .Location = TextBox_Lieu.Text .Body = TextBox_Description.Text 'Ajoute le rappel .ReminderMinutesBeforeStart = 15 .ReminderSet = True 'Sauvegarde et ferme .Save() End With 'Libération des variables. objAppt = Nothing objOutlook = Nothing MsgBox("Rdv ajouté!") Catch ex As Exception MsgBox("Error " & Err.Number & vbCrLf & Err.Description) End Try End Sub
Quelqu'un pourrait-il m'aider ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 MycalendarFolder = olns.GetDefaultFolder(olFolderCalendar)
Merci![]()
Partager