Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 4.0 Outlook加载项:获取所选会议的与会者电子邮件地址_C# 4.0_Outlook_Outlook Addin_Appointment - Fatal编程技术网

C# 4.0 Outlook加载项:获取所选会议的与会者电子邮件地址

C# 4.0 Outlook加载项:获取所选会议的与会者电子邮件地址,c#-4.0,outlook,outlook-addin,appointment,C# 4.0,Outlook,Outlook Addin,Appointment,我正在开发一个小型Outlook插件,它将获取有关所选会议的所有信息,并将这些信息推送到我们的内部门户。除要求的与会者部分外,实施已完成。不确定原因,但Interop.Outlook.AppointmentItem对象仅返回与会者的全名(作为字符串)。我对与会者的电子邮件地址更感兴趣。以下是我复制问题的代码片段: try { AppointmentItem appointment = null; for (int i = 1; i < Globals.ThisAddIn.A

我正在开发一个小型Outlook插件,它将获取有关所选会议的所有信息,并将这些信息推送到我们的内部门户。除要求的与会者部分外,实施已完成。不确定原因,但Interop.Outlook.AppointmentItem对象仅返回与会者的全名(作为字符串)。我对与会者的电子邮件地址更感兴趣。以下是我复制问题的代码片段:

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);
}
如果有人能帮助我解决这个问题,或者提供一些帮助来获取与会者的电子邮件地址,我将不胜感激

谢谢。

类似的内容(未经测试):

//收件人不是零索引的,从一开始
对于(int i=1;i
如果我们删除If条件
If(TheRecipient.Type==(int)Outlook.OlMailRecipientType.olTo)
,那么我们也可以获得可选与会者的电子邮件地址。
//
// 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; }
// 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;
}