VBA,Outlook,查看“人物日历" [英] VBA, Outlook, Seeing 'People's Calendars
问题描述
我正在尝试以编程方式(使用 VBA)访问其他人与我共享的日历.它们列在我的 Outlook 中的人员日历"下.我在网上搜索过这个,所有的建议都让我感到困惑.如何从人物日历"中获取共享给我的所有日历的列表,然后是特定的一个日历?
I am tring to programmatically (with VBA) to access calendars others share with me. They are listed in my Outlook under 'People's Calendars.' I have searched the Web for this and all the suggestions have done little more than confuse me. How can I get a listing of all the calendars shared to me, and then one calendar in specific, from among the 'People's Calendars'?
推荐答案
查看以下代码的返回值.它按姓名搜索某个人,就像您在新电子邮件中键入收件人一样,然后抓取该人的共享日历并枚举所有共享约会.
Check out the returned values from the following code. It searches for a person by name, same way as when you are typing a recipient into a new email, and then grabs that persons shared calendar and enumerates all shared appointments.
Dim _namespace As Outlook.NameSpace
Dim _recipient As Outlook.Recipient
Dim calendarFolder As Outlook.Folder
Set _namespace = Application.GetNamespace("MAPI")
Set _recipient = _namespace.CreateRecipient(name)
_recipient.Resolve
If _recipient.Resolved Then
Set calendarFolder = _namespace.GetSharedDefaultFolder(_recipient, olFolderCalendar)
'This would display the calendar on the screen:
'calendarFolder.Display
Dim oItems As Outlook.Items
Set oItems = calendarFolder.Items
'oItems is now a set of all appointments in that person's calendar
'Play on
End if
这篇关于VBA,Outlook,查看“人物日历"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!