Solved

Outlook Object Model - capturing modification or deletion of a Calendar item (AppointmentItem)

Posted on 2014-01-15
11
515 Views
Last Modified: 2014-02-07
Hello expertz!

I'm working on an Outlook Add-in, and I've come up against a brick wall.

We would like the Add-in to perform an action when someone:

1) Is looking at their Calendar and drags and drops and appointment to a different date and time.
2) Is looking at their Calender (again, in the Explorer view), but rather than opening an Appointment Item, deletes it straight from the Explorer. IOW - they single-click on the Appointment and hit the DEL button.


I've been looking through the Outlook Object Model but I can't seem to find any events that cover these things. The add-in was created in Add-in Express so any pointers to any events covered by that platform are welcome too.
0
Comment
Question by:WernerVonBraun
  • 5
  • 5
11 Comments
 
LVL 13

Accepted Solution

by:
Chris Raisin earned 500 total points
ID: 39815126
Can you include a bit of the code you have been playing about with?

I think you need to set up an event handler on a property of an appointment item
(calendar item)  and also capture a "delete" event using "onDelete" method of a calendar item.

I am investigating the best code to produce this, but your existing code will help enormously.

Cheers
Chris (craisin)
0
 
LVL 4

Author Comment

by:WernerVonBraun
ID: 39817194
Oh. Hello Chris.

I had actually forgotten I had posted this question. I have since found a solution.

Apologies

Pino
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 39817212
Thanks Pino.

Could you please post the solution for the benefit of others who may have the same problem, and then mark the question as completed.

I look forward to seeing your resolution! :-)

Cheers
Chris
0
 
LVL 4

Author Comment

by:WernerVonBraun
ID: 39817244
I can't post the code, but I will describe the solution.

First of all, I used the adxOutlookEvents_ExplorerBeforeItemPaste event (remember, I'm using Add-in Express).

At that moment, I have access to the item that is being pasted. I save that as a module level variable, and I set a dispatchertimer to tick when the application is inactive. When the timer ticks, the item has already been pasted and its datetime settings have changed, so I can then use that to update the corresponding information in our database.


I have a Class called EventHandler that holds a number of shared objects, including a "current appointment" defined "withevents". in adxOutlookEvents_ExplorerSelectionChanged I set the currentappointment. I can now capture the current appointment's "BeforeDelete" event. When that fires I can run code to update our database accordingly. I am aware that this won't cover the possibility to multi-select appointments and to delete them all in one go. I could, if I had to, code around that eventuality, too but I reckoned it wasn't worth my effort.



We have an Add-in Express form that is displayed at the top of each Calendar appointment when it's displayed. Which is handy as I can access the appointment's Inspector when that form loads. I again use the EventHandler class to keep a reference to that object, and again it's defined WithEvents, so that I can capture the Close event. Upon closing the inspector of an Appointment Item - Inspector_Close() - I can run code that processes any changes made and update our database accordingly.

Job done :-)
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 39817328
Great work!  :-)
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 4

Author Comment

by:WernerVonBraun
ID: 39817438
I've requested that this question be closed as follows:

Accepted answer: 0 points for WernerVonBraun's comment #a39817244

for the following reason:

Found my own solution. Wouldn't have minded giving Chris a few points as a thank you for reminding me that this was still open but (s)he didn't actually provide any suggestions this time.
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 39817412
I actually did offer a solution (although it was only an idea).

I am male by the way!  :-)   Must start calling myselfChristopher  :-)

Some points would be appreciated since I am trying to get enough to recommence my membership. (Unemployed for over 10 years now because I am 63 and nobody is willing to put an "oldie" to work so I cannot afford the annual fee....have been a member for over 15 years now I think!)

Just love EE! :-)
0
 
LVL 4

Author Closing Comment

by:WernerVonBraun
ID: 39817439
No problem. Since I can't split between myself and A.N.Other the points are all yours.

I thought I'd better play it safe. I know one or two girls who go by "Chris".
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 39817481
Thx heaps!
0
 
LVL 4

Author Comment

by:WernerVonBraun
ID: 39841602
Are you sure about that, _alias99 ? I tried to do that, but it either didn't allow me to pick my own ID as one of the contributors, or it didn't allow me to switch points. I don't remember exactly which...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Find out what you should include to make the best professional email signature for your organization.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now