Tuesday, January 25, 2011

How to handle delete meeting in outlook plugin application development using c#.net?

Now a days I am working in a development team which develops outlook plugin application. We are developing the outlook pluggin application using c#.net, outlook APIs and also Redemption APIs. The application is all about saving the outlook meetings as well as outlook appointments (both normal and recurring meetings) and then handling the insert update delete functions performed by the users. And also we have the calling feature in which we are giving facilities to call by using Skype and office communicator.

We are saving all the meeting and appointment deatils in the XML in the local machine. we are uniquly defining the meeting by the globalappointmentid. There are 3 events in the outlook for add, update and delete like appointments_ItemAdd(object Item), appointments_ItemChange(object Item), appointments_ItemRemove().

Here give a look at the parameters these 3 events are taking. In case  appointments_ItemRemove(), it is taking no parameter. And it causes the problem. Suppose you want to remove the meeting from the XML when a user delete a meeting from the calendar. Here the problem is: you will not get the globalappointmentid of the item which was deleted. I have searched a lot in google as well as in microsoft site as well. And they are clearly mentioned that you will never get the globalappointmentid since the item is already get deleted. So for this my solution is:
Read all items from the calender as well as all items from the XML and in that case you will get one item less in the calendar since one item you have already deleted. I got only one solution to do my task also hope you can achieve the task as well. There might be some performace issues like reading all the outlook items as well as XML items but you can filter by some date as well for some optimization.

if any one have any better solution then you are welcome to discuss with me.