title: Unable to read 'Outlook item' object as attachment with win32com
body: <p>I am attempting to return the filename of any attachment I come across as a string when iterating though a specific folder in Outlook using win32com. I have no issues when returning the filename as a string when the attachment is anything other than a 'Outlook item' ( <a href="https://i.imgur.com/UauktNV.png" rel="nofollow noreferrer">https://i.imgur.com/UauktNV.png</a> ) -- Unfortunately, this is the only type of attachment I actually have to process. The error I am facing is below... </p>
  
  <pre><code>  File "C:/Users/bob/PycharmProjects/program/program.py", line 76, in handle_email
      attachment = attachments.Item(1)
    File "&lt;COMObject &lt;unknown&gt;&gt;", line 2, in Item
  pywintypes.com_error: (-2147352567, 'Exception occurred.', (4096, 'Microsoft Outlook', 'Array index out of bounds.', None, 0, -2147352567), None)
  </code></pre>
  
  <p>My code is as follows</p>
  
  <pre><code>outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
  root_folder = outlook.Folders.Item(1)
  test = root_folder.Folders['test']
  messages = test.items
  
  attachments = message.Attachments
  attachment = attachments.Item(1)
  name = attachment.FileName
  </code></pre>
  
  <p>If I print 'attachments' I get <code>&lt;COMObject &lt;unknown&gt;&gt;</code> as well. Which led me to believe I am possibly not approaching the object from the property object hierarchy, as referenced here <a href="https://docs.microsoft.com/en-us/office/vba/api/outlook.attachment" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/office/vba/api/outlook.attachment</a> although AFAIK it seems to be correct but is probably why when I try to comment out <code>attachment</code> and <em>then</em> print <code>name</code> I get the error <code>AttributeError: &lt;unknown&gt;.FileName</code>.</p>
  
  <p>Note: My question is similar to this one --> <a href="https://stackoverflow.com/questions/51515373/filename-is-returned-as-null-when-an-outlook-item-msg-file-is-added-as-attach">Filename is returned as null when an outlook item (.msg file) is added as attachment to an outlook email sent</a></p>
  
  <p>But, I am unable to get far enough to even print a null value and the attachments I am trying to read have filenames anyway.</p>
  
  <p>Thank you.</p>