Solved

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

Posted on 2014-01-15
11
512 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
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: …

760 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

17 Experts available now in Live!

Get 1:1 Help Now