MS Access - 将约会事件添加到共享的Outlook日历
问题描述:
我想将约会添加到共享的Outlook日历中。我知道如何从MS Access添加到其他人的日历中,但我在共享日历方面遇到了问题。日历的创建者也有自己的个人日历。我以前的所有尝试都已添加到他们的个人日历中。MS Access - 将约会事件添加到共享的Outlook日历
这是我的代码...我试着在各种网站上收集代码,我只是卡住了。我感谢任何帮助。
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
答
更换线
outMail = Outlook.CreateItem(olAppointmentItem)
...
outMail.Send
与
outMail = objFolder.Items.Add
...
outMail.Save
您将学习如何使用上的错误继续下一步,如果你打算再次使用它保存几年你的生活。 – niton