VBA,展望,看到人民的日历 [英] 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,展望,看到人民的日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!