Adding and event handler on Item add RRS feed

  • Question

  • hi,

    I got a custom store with folders where I want to drag and drop mail items to from the inbox.
    I like to have and event whenever I drop a mail in the folders.
    How do I do this in

    Wednesday, May 13, 2009 2:42 PM


  • Hi Steve,

    I assume you are working on a VSTO project, the code should like this:

     Dim items As Outlook.Items
        Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
            Dim fld As Outlook.Folder
            fld = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts)
            items = fld.Items
            AddHandler items.ItemAdd, AddressOf Items_ItemAddxx
        End Sub
        Sub Items_ItemAddxx(ByVal Item As Object)
        End Sub

    everytime a new item added in Drafts folder of your Outlook the ItemAdd event triggers.


    We have published a VSTO FAQ recently, you can view them from the entry thread VSTO FAQ.
    If you have any feedbacks or suggestions on this FAQ, please feel free to write us emails to
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Tim Li Wednesday, May 20, 2009 2:00 AM
    Monday, May 18, 2009 9:52 AM