Multiple sent folders and SentItemsFolder.ItemAdd RRS feed

  • Question

  • I have an add-in that performs actions when emails hit the sent folder. I've taken this route to ensure emails are sent before any action is performed. Some of my clients are now running multiple email accounts in Outlook, each of which has it's own Sent folder. However, it appears that SentItemsFolder.ItemAdd only fires when the primary email account is used, or the primary Sent Folder it added to. Any suggestions?
    Thursday, April 11, 2013 2:14 AM


All replies

  • itemadd event fires on eevery folder, assuming you attached properly to those events. Show us your code for event attaching
    Thursday, April 11, 2013 4:16 AM
  • It's fairly simple:

     Private Sub SentItemsFolder_ItemAdd(ByVal Item As Object) Handles SentItemsFolder.ItemAdd
              Message = TryCast(Item, Outlook.MailItem)
              '' Do stuff
          Catch ex As System.Exception
              '' Handle error
          End Try
      End Sub

    I wanted to find out if there is some catch if there are multiple Sent folders. It seems that my add-in does not fire a  SentItemsFolder.ItemAdd event for folders other than the default account's sent folder.

    Thursday, April 11, 2013 4:26 AM
  • Sorry, found my problem. I get the "Default Send Folder" (using Application.Session.GetDefaultFolder(OlDefaultFolders.olFolderSentMail).Items) and then listen for events on that folder. I need to get ALL sent folders and listen on all of them.

    I take it there is a way of getting a list of all Sent Folders?

    Thursday, April 11, 2013 5:09 AM
  • iterate through Session.Stores and call getdefaultfolder on each store
    Thursday, April 11, 2013 7:38 AM