获取会议组织者

此代码示例展示了如何以编程方式返回会议组织者。

示例

注意

下面的代码示例摘录自 Microsoft Office Outlook 2007 应用程序编程

在下面的代码示例中,GetMeetingOrganizer 需要使用表示会议的 AppointmentItem 类型参数,并使用 PropertyAccessor 对象和 GetProperty(String) 方法来获取 AppointmentItem 对象的 EntryID。 获取 EntryID 后,此代码示例使用 GetAddressEntryFromID(String) 方法,返回表示会议组织者的 AddressEntry 对象。

如果使用 Visual Studio 测试此代码示例,必须先添加对 Microsoft Outlook 15.0 对象库组件的引用,并在导入 Microsoft.Office.Interop.Outlook 命名空间时指定 Outlook 变量。 不得将 using 语句直接添加到此代码示例中的函数前面,这个语句必须后跟公共类声明。 下面的代码行演示了如何在 C# 中执行导入和分配。

using Outlook = Microsoft.Office.Interop.Outlook;
private Outlook.AddressEntry GetMeetingOrganizer(Outlook.AppointmentItem appt)
{
    if (appt == null)
    {
        throw new ArgumentNullException();
    }
    string PR_SENT_REPRESENTING_ENTRYID =
        @"http://schemas.microsoft.com/mapi/proptag/0x00410102";
    string organizerEntryID =
        appt.PropertyAccessor.BinaryToString(
            appt.PropertyAccessor.GetProperty(
            PR_SENT_REPRESENTING_ENTRYID));
    Outlook.AddressEntry organizer =
        Application.Session.
        GetAddressEntryFromID(organizerEntryID);
    if (organizer != null)
    {
        return organizer; 
    }
    else
    {
        return null;
    }
}

另请参阅