Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

New Post: AppointmentItem Write event never triggers

$
0
0
Hi,

I am trying to use the AppointmentItem's Write event to give the user an option to cancel the change to a meeting in the calendar. ItemLoadCallback is called fine whenever the appointment is opened in Outlook which is what I want. I then register the Write event, but it never triggers. I have looked in OutlookSpy and the AppointmentItem does receive the event, but I just cannot figure out why event in the code below is not reached. Does anyone have any clue why?
_outlookApplication.ItemLoadEvent += new Outlook.Application_ItemLoadEventHandler(AddinLogic.ItemLoadCallback);

static Outlook.AppointmentItem _appointment = null; 

        public static void ItemLoadCallback(NetOffice.COMObject obj)
        {
            using (Outlook.AppointmentItem tmp = obj as Outlook.AppointmentItem)
            {
                if (tmp == null)
                    return;

                _appointment = tmp;
                _appointment.WriteEvent += new Outlook.AppointmentItem_WriteEventHandler(AddinLogic.AppointmentWriteEventHandler);
            }
        }

        private static void AppointmentWriteEventHandler(ref bool Cancel)
        {
// execution never gets here
            int i = 9;
        }

Viewing all articles
Browse latest Browse all 1741

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>