If you keep records of messages on an external database for backup purposes, you might need to operate on these records when the original message is deleted from the Exchange Server. For example, in such a case, you might want to delete the corresponding records as well. To do this, you need to relate the deleted message with the record of it. This article suggests a way to do this.
When a message is deleted from a folder, Folder_OnMessageDeleted event of the Microsoft Exchange Server Scripting Agent returns a MessageID. In the Exchange Store, this MessageID equals the PR_SOURCE_KEY property of the original message.
↑ Back to the top
To be able to reach the record on the external database after the original message is deleted from the Exchange store, you can create a field on the record (as the database record's primary key) and keep the PR_SOURCE_KEY property of the original message on this field. Then, you can use the MessageID returned from the Folder_OnMessageDeleted event to track down the record. The MessageID can be obtained using the MessageID property of the EventDetails object in Folder_OnMessageDeleted event.
When a message is created in an information store, the information store assigns a value to the PR_SOURCE_KEY property on the message. For Microsoft Exchange Server, this property is 22 bytes in length, including the store GUID (16 bytes) and a 6-byte unique number that identifies the object within the store.
↑ Back to the top
For more information about the PR_SOURCE_KEY property, please refer to the
Microsoft Developer Network.
For more information on installing and using Microsoft Exchange Server
Event Agents, please see the Agents.hlp file on the Microsoft Exchange
Server CD-ROM.
↑ Back to the top