Microsoft KB Archive/231160

= How To Relate a Deleted Message Using Folder_OnMessageDeleted =

Article ID: 231160

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Collaboration Data Objects 1.2
 * Microsoft Collaboration Data Objects 1.21
 * Microsoft Exchange Server 5.5 Standard Edition

-



This article was previously published under Q231160



SUMMARY
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.



MORE INFORMATION
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.

