title: Delete email from inbox and also delete it from deleted-items folder via rule->script
body: <p><br> <br>
  I created a rule, that starts a VBA-script depending on the subject of a received email (Rule: Subject "MY_SUBJECT" -> start script). <br>
  The VBA script is then doing some stuff and then it should finally delete the original email. </p>
  
  <p>This part is easy:</p>
  
  <pre><code>Sub doWorkAndDeleteMail(Item As Outlook.MailItem)
  ' doSomething:
  
  ' delete email from inbox
  Item.Delete
  End Sub
  </code></pre>
  
  <p><br> Now the email will sit in the deleted-items-folder. But what I need to achieve is, to also delete this mail from the deleted-items folder. Since I know the subject of this mail (because this triggered my rule in the first place), I tried the following approach:</p>
  
  <pre><code>Sub doWorkAndDeleteMail(Item As Outlook.MailItem)
  ' doSomething:
  
  ' delete email from inbox
  Item.Delete
  End Sub
  
  ' delete email from deleted items-folder
  Dim deletedFolder As Outlook.Folder
  
  Set deletedFolder = Application.GetNamespace("MAPI"). _
      GetDefaultFolder(olFolderDeletedItems)
  
  Dim i As Long
  For i = myFolder.Items.Count To 1 Step -1
  
  If (deletedFolder.Items(i).Subject) = "MY_SUBJECT" Then
  
  deletedFolder.Items(i).Delete
  Exit For
  End If
  Next if
  
  End Sub
  </code></pre>
  
  <p><br>Well, this basically works: The mail with this subject will be found in the deleted-items-folder and it will be deleted, yes.
  But sadly it does not work as expected:
  This permanent deletion only works once I start the script a second time. </p>
  
  <p>So the email which is triggering my script will never be deleted permanently in this script's actual run, but only in the next run (once the next email with the trigger-subject for my rule is received - but then this very next email won't be deleted, again).</p>
  
  <p>Do you have any idea what I am doing wrong here? It somehow looks like I need to refresh my deleted-items folder somehow. Or do I have to comit my first <code>Item.Delete</code> somehow explicitly?</p>