title: Python Outlook handle emails that were recalled by sender
body: <p>I'm currently writing a script in Python 2.7 which iterates through emails in an outlook folder, retrieves The email senders and saves the emails to a folder on the local machine. <strong>There's a problem however when the email has been recalled by the sender</strong>, an error occurs and the script doesn't work. Here's the bit of code that causes an error:</p>
  
  <pre><code>    if message.Class == 43:
          if message.SenderEmailType == 'EX':
              Sender = message.Sender.GetExchangeUser().PrimarySmtpAddress
          else:
              Sender = message.SenderEmailAddress
  </code></pre>
  
  <p>and the error:</p>
  
  <blockquote>
    <p>if message.SenderEmailType == 'EX':   File
    "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 516,
    in <strong>getattr</strong>     ret =
    self.<em>oleobj</em>.Invoke(retEntry.dispid,0,invoke_type,1)
    pywintypes.com_error: (-2147467262, 'No such interface supported',
    None, None)</p>
  </blockquote>
  
  <p>the question is, how do i handle such objects where the email has been recalled by the sender? I have to either skip them or move them to a different folder but message.Move doesnt work either on recalled emails (same error, no such interface supported).</p>
  
  <p>whole code:</p>
  
  <pre><code>import os
  import win32com.client
  import itertools
  import shutil
  
  
  OlSaveAsType = {
      "olTXT": 0,
      "olRTF": 1,
      "olTemplate": 2,
      "olMSG": 3,
      "olDoc": 4,
      "olHTML": 5,
      "olVCard": 6,
      "olVCal": 7,
      "olICal": 8
  }
  
  outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
  folder = outlook.Folders("MyFolder")
  inbox = folder.Folders("Inbox")
  Checked = inbox.Folders("Checked")
  Sent = inbox.Folders("Sent")
  
  
  messages = Checked.Items
  a = (len(messages))
  message = messages.GetFirst()
  id = 1
  
  
  for _ in itertools.repeat(None, a):
  
      messages = Checked.Items
      message = messages.GetFirst()
      Subject = message.subject
  
      if message.Class == 43:
          if message.SenderEmailType == 'EX':
              Sender = message.Sender.GetExchangeUser().PrimarySmtpAddress
          else:
              Sender = message.SenderEmailAddress
  
      message.SaveAs(newpath + '\\' + Sender + " " + str(id) + ".msg", OlSaveAsType['olMSG'])
      id = int(id)
      id += 1
      message.Move(Sent)
      if id == 600:
          break
      message = messages.GetNext()
  </code></pre>