OVH Cloud OVH Cloud

Calendrier d'un autre utilisateur

1 réponse
Avatar
brucat
Bonjour,

j'aimerai crée un rendez-vous dans un calendrier d'un autre utilisateur en
VBA;

Voici le code standard pour la création dans mon calendrier, comment le
modifier ?

Merci

Private Sub Outlook_Click()

On Error GoTo RV_Erreur
Dim OL_App As New Outlook.Application
Dim OL_RV As Outlook.AppointmentItem
Set OL_RV = OL_App.CreateItem(olAppointmentItem)

With OL_RV
.Start = "12/06/06 09:00:00"
.Duration = 480
.Subject = "preparation"
.Body = "Valider dossier Client " & vbCrLf & "Preparation dossier"
.Location = "chez nous"
.ReminderSet = True
.Importance = olImportanceHigh
.Save
End With

Set OL_RV = Nothing
Set OL_App = Nothing
Exit Sub

RV_Erreur:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Set OL_RV = Nothing
Set OL_App = Nothing
End Sub

1 réponse

Avatar
Laurent Francfort [MS]
Bonjour,

Je pars du principe que tu es connecté à un serveur Exchange, car c'est le
serveur Exchange qui va t'apporter la capacité d'ouvrir la BAL d'un autre
utilisateur.

Il faut utiliser la méthode GetSharedDefaultFolder :

Dim OL_App As New Outlook.Application

Set olNameSpace = OL_App.getnamespace("MAPI")
olNameSpace.logon "","",false,false
Set myRecipient = olNameSpace.CreateRecipient("Jean DUPONT")
myRecipient.Resolve
Set MyrecipientFolder = olNameSpace.GetSharedDefaultFolder (myRecipient,
olFolderContacts)
Set MyMeetings = MyrecipientFolder.items
Set OL_RV = MyMeetings.add
With OL_RV
.Start = "12/06/06 09:00:00"
.Duration = 480
.Subject = "preparation"
.Body = "Valider dossier Client " & vbCrLf & "Preparation dossier"
.Location = "chez nous"
.ReminderSet = True
.Importance = olImportanceHigh
.Save
End With




"brucat" a écrit dans le message de news:
dvk1ak$cc3$
Bonjour,

j'aimerai crée un rendez-vous dans un calendrier d'un autre utilisateur en
VBA;

Voici le code standard pour la création dans mon calendrier, comment le
modifier ?

Merci

Private Sub Outlook_Click()

On Error GoTo RV_Erreur
Dim OL_App As New Outlook.Application
Dim OL_RV As Outlook.AppointmentItem
Set OL_RV = OL_App.CreateItem(olAppointmentItem)

With OL_RV
.Start = "12/06/06 09:00:00"
.Duration = 480
.Subject = "preparation"
.Body = "Valider dossier Client " & vbCrLf & "Preparation dossier"
.Location = "chez nous"
.ReminderSet = True
.Importance = olImportanceHigh
.Save
End With

Set OL_RV = Nothing
Set OL_App = Nothing
Exit Sub

RV_Erreur:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Set OL_RV = Nothing
Set OL_App = Nothing
End Sub