HOWTO: Relate a Deleted Message Using Folder_OnMessageDeleted

ID: Q231160


The information in this article applies to:


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.


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.

Additional query words: kbCDO120 kbCDO121 kbMsg kbXchge550 kbGrpMsg


Keywords          : kbCDO120 kbCDO121 kbXchge550 kbMsg kbGrpMsg 
Version           : WINDOWS:1.2,1.21; winnt:5.5
Platform          : WINDOWS winnt 
Issue type        : kbhowto 

Last Reviewed: May 26, 1999