/ / MS Access - додайте подію зустрічі до спільного календаря Outlook - vba, ms-access, Outlook, calendar, shared

MS Access - додайте подію зустрічі для спільного календаря Outlook - vba, ms-access, Outlook, calendar, shared

Я хочу додати зустріч до спільного Outlookкалендар Я знаю, як додати до інших людей календарі з MS Access, але у мене виникають проблеми зі спільними календарями. Творець календаря також має свій особистий календар. Всі мої попередні спроби щойно додані в їх особистий календар.

Ось мій код ... Я намагався збирати код на різних веб-сайтах, і я просто застряг. Я ціную будь-яку допомогу.

Private Sub Add_to_Shared_Calendar_Click()
Dim outMail As Outlook.AppointmentItem
Dim objNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder "get name of other persons folder
Dim objRecip As Outlook.Recipient "other persons name
Dim strName As String "the name or email of the persons folder
Dim objAppt As Outlook.AppointmentItem
Dim objApp As Outlook.Application
On Error Resume Next
" name of person whose Calendar you want to use - right?
strName = "John Smith - Project Name Shared Calendar"
Set objNS = objApp.GetNamespace("MAPI")
Set objRecip = objNS.CreateRecipient(strName)
Set objFolder = objNS.GetSharedDefaultFolder(objRecip, olFolderCalendar)
Set outMail = Outlook.CreateItem(olAppointmentItem)
outMail.Subject = "test"
outMail.Location = ""
outMail.MeetingStatus = olMeeting
outMail.Start = Me.dateofevent
outMail.End = Me.TimeofEvent
outMail.RequiredAttendees = strName
outMail.Body = "test message"
outMail.Send
Set outMail = Nothing
End Sub

Відповіді:

1 для відповіді № 1

Замініть лінії

 outMail = Outlook.CreateItem(olAppointmentItem)
...
outMail.Send

з

 outMail = objFolder.Items.Add
...
outMail.Save