Domanda VB.Net and ItemAdd event

  • venerdì 15 aprile 2011 12:27
     
      Contiene codice

    Hi, I'm writing a little vb.net application that manage incoming email from outlook COM.

    When i only handle the ItemAdd, there is no problem, but when i try to rescan the folder from within the function handler, my application freeze.

    Here the code:

     Private Sub oNewMail_ItemAdd(ByVal Item As Outlook.MailItem) Handles oNewMail.ItemAdd
        
        processIncomingEmail(Item)
        checkMailFolder()
    End Sub
    
    Private Sub checkMailFolder()
    
        Dim items As Outlook.Items
        Dim item As Outlook.MailItem
        items = Me.objOL.Session.Folders("Cassetta postale - Gestione WAS").Folders(Me.sNomeCartella).Items
    'other code
       
    End Sub
    

    The problem is when i try to set the "items" object.

    Thanks in advance

     

Tutte le risposte