我们正在开发C#中的实用程序来阅读Outlook预约,监控收件人是否已接受或拒绝预约等。如何在接受或拒绝Outlook预约时获取收件人添加的评论
Application Myoutlook = new Application();
NameSpace OutlookNS = Myoutlook.GetNamespace("MAPI");
Outlook.AppointmentItem appt = Myoutlook.Session.
GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar).
Items.Find("[Subject]='" + trainingName + "'")
as Outlook.AppointmentItem;
string organizerName = appt.Organizer;
if (appt == null)
{
return null;
}
if (appt != null)
{
foreach (Outlook.Recipient recip in appt.Recipients)
{
答案 0 :(得分:0)
你的" appt"包含约会的变量有一个body属性,它包含消息。
所以,例如,如果你给我发了一条消息,我拒绝说'#34;抱歉洗头发" appt.body将包含我的信息。
答案 1 :(得分:0)
public static void ReadOutlookResponse(string outlookAppointmentName)
{
Outlook.Items folderItems = null;
string searchCriteria = "[Subject]='" + outlookAppointmentName + "'";
// 1 - Returns Only 1
MeetingItem item = null;
Application myoutlook = new Application();
item = myoutlook.Session.GetDefaultFolder(OlDefaultFolders.olFolderInbox).Items
.Find("[Subject]='" + outlookAppointmentName + "'");
string body = item.Body;
// 2 - Loop and Return All
folderItems = myoutlook.Session.GetDefaultFolder(OlDefaultFolders.olFolderInbox).Items;
object resultItem = folderItems.Find(searchCriteria);
while (resultItem != null)
{
if (resultItem is Outlook.MeetingItem)
{
item = resultItem as Outlook.MeetingItem;
body = item.Body;
}
Marshal.ReleaseComObject(resultItem);
resultItem = folderItems.FindNext();
}
}
可以增强代码以使用GlobalAppointmentID。上面的代码将返回会议响应。