Get Subject of a delete Appointment in a shared exchange calendar

Joined
Nov 3, 2015
Messages
2
Reaction score
0
I am writing a program in VB to detect when an appointment is deleted from a shared exchange calendar, and then send an email notification that that item was deleted. We use Office 365 and Exchange server 2010. When I delete the appointment it shows up in "Recover deleted Items" (BeforeItemDelete does not work).
So I setup the Redemption library but I can't figure out how to retrieve the subject of the deleted appointment. After some reading and research I understand that I can use RDOs ItemRemove if I cache the Entry_ID using MAPITable and then use PR_Instance_Key to somehow get the subject. But I have no idea how to actually do this practically speaking - I'm hoping someone out there point me in the direction of the right literature to understand how to use MAPITable in this way?
Here's what I have so far:

'Trigger on events
Dim WithEvents trashCalendar As Redemption.RDOItems

'Sets up the Calendar folders and item variables
Private Sub Application_Startup()
'Outlook Redemption variables Set Session2 = CreateObject("Redemption.RDOSession")
Session2.Logon
Set RDOJobFolder = Session2.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("TRSI - Canada")
Set RDOJobFolder = RDOJobFolder.Folders("Marine Jobs")
Set trashCalendar = RDOJobFolder.DeletedItems
End Sub

'Detect "Delete" event
Private Sub trashCalendar_ItemAdd(ByVal Item As RDOMail)
Dim olkMsg As Outlook.MailItem
Set olkMsg = Application.CreateItem(olMailItem)
With olkMsg
'Add more recipients as needed by duplicating the next line'
.Recipients.Add "test.email"
.Recipients.ResolveAll
'Change the subject ont he next line'
.Subject = "000-Marine Job Deleted from Calendar"
'Change the message body on the next line'
.Body = "****DELETE**** " & Item.Subject
.Send
End With
Set olkMsg = Nothing
End Sub
 
Last edited by a moderator:
Joined
Nov 3, 2015
Messages
2
Reaction score
0
So for now I came up with the following as a work around:

'Get the most recently deleted appointment
Set Table = CreateObject("Redemption.MAPITable")
Table.Item = trashCalendar
Table.Sort PR_LAST_MODIFICATION_TIME, True
Set Recordset = Table.ExecSQL("SELECT Subject from Folder")

This works 90% of the time, but if you delete two items in quick succession sometimes the wrong subject shows up as outlook/exchange gets confused as to which is the new last_modification_time. Any suggestions to make this better would be much appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top