我使用以下link
创建并发送了约会我的代码:
Microsoft.Office.Interop.Outlook.Application app = null;
Microsoft.Office.Interop.Outlook.AppointmentItem appt = null;
app = new Microsoft.Office.Interop.Outlook.Application();
appt = (Microsoft.Office.Interop.Outlook.AppointmentItem)app
.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
appt.Subject = "Meeting ";
appt.Body = "Test Appointment body";
appt.Location = "TBD";
appt.Start = Convert.ToDateTime("06/01/2012 05:00:00 PM");
appt.Recipients.Add("sanjay.surendra@mycompany.com");
appt.End = Convert.ToDateTime("06/01/2012 6:00:00 PM");
appt.ReminderSet = true;
appt.ReminderMinutesBeforeStart = 15;
appt.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh;
appt.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy;
appt.Save();
Microsoft.Office.Interop.Outlook.MailItem mailItem = appt.ForwardAsVcal();
mailItem.To = "sanjay.surendra@mycompany.com";
mailItem.Send();
现在我想要一个唯一的约会ID,我可以在我的代码中处理它。请建议
答案 0 :(得分:2)
您在寻找Appointment.EntryID吗?
答案 1 :(得分:1)
Appointment.EntryID
正是您要找的。保存或发送项目(持久)后,将分配EntryID
属性。
// ...
appt.Save();
string entryID = appt.EntryID;
// ...
MAPI商店提供程序在其商店中创建项目时分配唯一的ID字符串。因此,在保存或发送之前,不会为Outlook项目设置 EntryID属性。当项目移动到另一个商店时,条目ID会更改...