1

選択した会議に関するすべての情報を取得し、この情報を社内ポータルにプッシュする小さな Outlook アドインを開発しています。RequiredAttendees 部分を除いて実装は完了です。理由はわかりませんが、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);
}

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; }

誰かがこの問題を解決するのを手伝ってくれたり、出席者の電子メール アドレスを取得する方法を教えてくれたりしたら、とてもありがたいです。

ありがとう。

4

1 に答える 1

3

このようなもの(テストされていません):

// 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;
}
于 2013-01-16T05:04:19.697 に答える