Outlook 加载项:获取所选会议的与会者电子邮件地址
Posted
技术标签:
【中文标题】Outlook 加载项:获取所选会议的与会者电子邮件地址【英文标题】:Outlook Add-in: Fetch attendees email address of selected meeting 【发布时间】:2012-12-23 22:34:10 【问题描述】:我正在开发一个小型 Outlook 插件,它将获取有关所选会议的所有信息并将这些信息推送到我们的内部门户。除了RequiredAttendees 部分外,实施已完成。不知道为什么,但 Interop.Outlook.AppointmentItem 对象只返回与会者的全名(作为字符串)。我对他们的与会者电子邮件地址更感兴趣。这是我的代码 sn-p 来复制问题:
try
AppointmentItem appointment = null;
for (int i = 1; i < Globals.ThisAddIn.Application.ActiveExplorer().Selection.Count + 1; i++)
Object currentSelected = Globals.ThisAddIn.Application.ActiveExplorer().Selection[i];
if (currentSelected is AppointmentItem)
appointment = currentSelected as AppointmentItem;
// I am only getting attendees full name here
string requiredAttendees = appointment.RequiredAttendees;
catch (System.Exception ex)
LogException(ex);
我可以看到 RequiredAttendees 属性在 Microsoft.Office.Interop.Outlook._AppointmentItem 界面中定义为字符串。
//
// Summary:
// Returns a semicolon-delimited String (string in C#) of required attendee
// names for the meeting appointment. Read/write.
[DispId(3588)]
string RequiredAttendees get; set;
如果有人可以帮助我解决此问题或提供一些帮助以获取与会者的电子邮件地址,我将不胜感激。
谢谢。
【问题讨论】:
【参考方案1】:类似这样的东西(未测试):
// Recipients are not zero indexed, start with one
for (int i = 1; i < appointment.Recipients.Count - 1; i++)
string email = GetEmailAddressOfAttendee(appointment.Recipients[i]);
// Returns the SMTP email address of an attendee. NULL if not found.
function GetEmailAddressOfAttendee(Recipient TheRecipient)
// See http://msdn.microsoft.com/en-us/library/cc513843%28v=office.12%29.aspx#AddressBooksAndRecipients_TheRecipientsCollection
// for more info
string PROPERTY_TAG_SMTP_ADDRESS = @"http://schemas.microsoft.com/mapi/proptag/0x39FE001E";
if (TheRecipient.Type == (int)Outlook.OlMailRecipientType.olTo)
PropertyAccessor pa = TheRecipient.PropertyAccessor;
return pa.GetProperty(PROPERTY_TAG_SMTP_ADDRESS);
return null;
【讨论】:
如果我们去掉if (TheRecipient.Type == (int)Outlook.OlMailRecipientType.olTo)
的if条件,那么我们也可以得到可选与会者的电子邮件地址。以上是关于Outlook 加载项:获取所选会议的与会者电子邮件地址的主要内容,如果未能解决你的问题,请参考以下文章
UCWA 可以检索已安排的 Microsoft Outlook 会议吗?