Reputation: 47
I have created and sent a appointment using following link
My code:
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("[email protected]");
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 = "[email protected]";
mailItem.Send();
Now i want the unique appointment ID which i can handle it in my code. Please advice
Upvotes: 2
Views: 2530
Reputation: 31651
The Appointment.EntryID
is what you are looking for. After an item is Saved or Sent (persisted) the EntryID
property is assigned.
// ...
appt.Save();
string entryID = appt.EntryID;
// ...
A MAPI store provider assigns a unique ID string when an item is created in its store. Therefore, the EntryID property is not set for an Outlook item until it is saved or sent. The Entry ID changes when an item is moved into another store...
Upvotes: 1