取得會議召集人
此範例示範如何以程序設計方式傳回會議召集人。
範例
注意事項
下列程式代碼範例是 Microsoft Office Outlook 2007 程式設計應用程式的摘錄。
在下列程式代碼範例中,GetMeetingOrganizer 會採用代表會議之 AppointmentItem 類型的參數,並使用 PropertyAccessor 物件和 GetProperty (String) 方法來取得 AppointmentItem 物件的 EntryID。 取得 EntryID 之後,此範例會使用 GetAddressEntryFromID (String) 方法傳回代表會議召集人的 AddressEntry 物件。
If you use Visual Studio to test this code example, you must first add a reference to the Microsoft Outlook 15.0 Object Library component and specify the Outlook variable when you import the Microsoft.Office.Interop.Outlook namespace. The using statement must not occur directly before the functions in the code example but must be added before the public Class declaration. The following line of code shows how to do the import and assignment in 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;
}
}