title: Access MailItem properties of Outlook msg attachment
body: <p>I'm trying to use vbscript to extract mail item details from hundreds of old Exchange Journal Outlook PST files.  All the items in the PST archives are made up of an &quot;envelope&quot; mail item with an .msg attachment that's the actual e-mail whose properties I want to capture.</p>
  <p>I can access the attachment object, but cannot extract the MailItem properties and collections listed below, presumably because the attachment isn't opening as a Mail Item.  I've tried to use the PropertyAccessor object, but I can't get any results from it.</p>
  <p>The only workaround I've come up with is to use the SaveAsFile method to save each attachment to file, then CreateItemFromTemplate to open the saved file, which then provides full access to the Mail Item properties of the object.  However, the delay caused by the disk operations is excessive.  My basic &quot;workaround&quot; code for returning a &quot;objMsg&quot; MailItem object is:</p>
  <pre><code>    Set objOL=WScript.CreateObject(&quot;Outlook.Application&quot;)
      set objNS=objOL.GetNameSpace(&quot;MAPI&quot;)
      Set objPST = objNS.Folders(strPSTname).Folders(&quot;Inbox&quot;).Items
      Set objItem = objPST.Items(1)
      objItem.Attachments(1).SaveAsFile(conTempPath)
      Set objMsg = objOL.CreateItemFromTemplate(conTempPath)
  </code></pre>
  <p>Is anyone aware of a better method for accessing the Mail Item properties of a .msg attachment?</p>
  <pre><code>    objItem.Class
      objItem.ReceivedTime
      objItem.SenderEmailAddress
      objItem.SenderName
      objItem.SentOnBehalfOfName
      objItem.Subject
      objItem.Attachments
      objItem.Recipients
      objItem.To
      objItem.Cc
      objItem.Bcc
  </code></pre>