title: Python Script not getting most recent mail from outlook
body: <p>I have a python script that fetches recent mail from my inbox, it works fine but the problem is that it fetches an old mail as the most recent email.</p>
  
  <p>I have synchronized my Outlook Application and it's now displaying all my recent emails as well but the python script keep on fetching an old mail prior to the synchronization.</p>
  
  <p>I have also uninstalled the Outlook Application and downloaded new one from microsoft store, yet the script is showing the same old mail. I uninstalled pywin32, hoping to make a new connection to the Outlook Application, yet no positive result.</p>
  
  <p>Here is my python script:</p>
  
  <pre><code>import win32com.client #pip install pywin32 if not installed
  
  # Connect to Outlook by MAPI
  outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
  
  inbox = outlook.GetDefaultFolder(6) # "6" refers to the index of a folder - in this case,
                                      # the inbox. You can change that number to reference
                                  # any other folder
  messages = inbox.Items
  message = messages.GetFirst()
  body_content = message.body
  sender = message.sender
  subject = message.Subject
  date = message.senton.date()
  time = message.senton.time()
  attachments = message.Attachments
  print(body_content)
  </code></pre>
  
  <p>Is the problem from my script? How can I make this script to synchronize with my Outlook Application?</p>