Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How To Relate a Deleted Message Using Folder_OnMessageDeleted


View products that this article applies to.

This article was previously published under Q231160

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


References

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


Keywords: KB231160, kbmsg, kbhowto, kbfaq

↑ Back to the top

Article Info
Article ID : 231160
Revision : 5
Created on : 7/1/2004
Published on : 7/1/2004
Exists online : False
Views : 476