When the birthday or anniversary for a contact item is set an appointment item is created automatically. If the contact is removed those appointments are not. This article Find Outlook AppointmentItem for ContactItem gave me the solution to remove those appointments. So that is great but I want to identify the “orphaned” appointments that where related to an already removed contact. Looking at the properties of a birthday appointment I found four properties that store contact information.
Using the appointment.PropertyAccessor I am able to get a value for PidLidContactLinkEntry (http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/85850102) and PidLidContactLinkSearchKey.( http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/85840102) both PT_BINARY values.
The other 2 are not exposed by Outlook it looks like. PidLidContactLinkEntry is documented here: https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcmsg/305ad82d-f941-4c45-813c-99a8cb5403aa PidLidContactLinkSearchKey is documented here: https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcmsg/85875108-dbb6-4ef7-a7c6-c89e914c1a47
Here is my question: How do I get the value for the contact Name or EntryID. Using the above property values?
As PidLidContactLinkEntry
docs suggest, you can parse the blob and extract the entryid of the contact.
You can also use the value of the PidLidContactLinkSearchKey
property to search for the matching contact in the default Contacts folder. Keep in mind that OOM would not let you search for the binary (PT_BINARY) properties; if using Redemption (I am its author) is an option, its version of RDOFolder.Items
.Find/Restrict
allows to search on binary properties using a query like "http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/85840102" = '1234567890ABCDEF'