Friday, November 11, 2011

Firing Order of Events


Firing Order of Events

For item-level events, you can clearly predict the sequence in which events will fire. However, events at the application level are less predictable. You cannot guarantee that event firing will follow a specific sequence either because different events cause a unique firing sequence or because, in future versions of Outlook, the event sequence might change. Some insights into a typical firing sequence are offered here. If you want to investigate further, it is suggested that you write Debug.Print Object EventName statements for each event procedure supported by a given object variable declared using the WithEvents keyword. The following list shows just such a debug sequence when a user opens a mail message, enters recipients for the message, types a subject and message body, and then sends the message. Again, don't take this sequence as invariable; it simply gives you a reasonable expectation of the event sequence when you send a mail message.
  1. Inspectors NewInspector
  2. MailItem Open
  3. Explorer Deactivate
  4. Inspector Activate
  5. MailItem Read
  6. MailItem PropertyChange To
  7. MailItem PropertyChange CC
  8. MailItem PropertyChange BCC
  9. MailItem BeforeCheckNames
  10. MailItem PropertyChange To
  11. MailItem PropertyChange CC
  12. MailItem PropertyChange BCC
  13. MailItem PropertyChange Conversation Index
  14. MailItem PropertyChange ReceivedTime
  15. MailItem PropertyChange Subject
  16.  Application ItemSend   
  17. MailItem Write
  18. MailItem Close
  19. Inspector Deactivate
  20. Explorer Activate

No comments:

Post a Comment