I'm trying to create a Outlook 2013 AddIn and I have some troubles accessing the properties of the AppointmentItem. Afterwards you find a shortened example code:
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
this.Application.ItemLoad += new Outlook.ApplicationEvents_11_ItemLoadEventHandler(Application_ItemLoad);
}
void Application_ItemLoad(object Item)
{
if (Item is Outlook.AppointmentItem)
{
try
{
appointmentItem = Item as Outlook.AppointmentItem;
string sub = appointmentItem.Subject; // <--------
...
The problem ist, that I'cannot access the properties of the appintment because the data is not yet available for the memory:
MSDN: ApplicationEvents_11_Event.ItemLoad event: This event occurs when the Outlook item begins to load into memory. Data for the item is not yet available, other than the values for the Class and MessageClass properties of the Outlook item, so an error occurs when calling any property other than Class or MessageClass for the Outlook item returned in Item. Similarly, an error occurs if you attempt to call any method from the Outlook item, or if you call the GetObjectReference method of the Application object on the Outlook item returned in Item.
The aim behind my AddIn is, to display a DropDownBox in the Ribbon Bar where the displayed items depend on the value of the subject (and some other properties) of the appointment. So is there a way to access the properties of the appointment during the eventhandler? Or is there any ohter eventhandler where I can change the DropDownBox while the Appointment gets loadad?
Thank you & regards Andi
AppointmentItem.ReadComplete
Event msdn.microsoft.com/en-us/library/office/jj229473.aspx and the properties should be there – tobsenThe statement this.Application.ActiveInspector().CurrentItem as Outlook.AppointmentItem;
doesn't work. – Andi KReadComplete
event for yourappointmentItem = Item as Outlook.AppointmentItem;
– tobsen