VBA,Outlook,查看“人们的日历" [英] VBA, Outlook, Seeing 'People's Calendars

查看:16
本文介绍了VBA,Outlook,查看“人们的日历"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以编程方式(使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆