I am using the following code to get information from Outlook .msg files (created by Save As from
Outlook), such as .SenderName, etc., as shown in the code. This works on all but two of many
.msg files.
The problem is that it does not work on .msg files that are actually saved meeting notices.
I get the following error:
Unable to cast COM object of type 'System.__ComObject' to interface type
'Microsoft.Office.Interop.Outlook.MailItem'. This operation failed because the QueryInterface
call on the COM component for the interface with IID '{00063034-0000-0000-C000-000000000046}' failed
due to the following error: No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE))
Then I have to exit Outlook to clear the error.
I have searched with Google and found another person who had this problem, but no solution was given.
Any ideas of how to process the meeting notices?
Thanks.
Code:Dim oOutL As New Outlook.Application Dim oMail As Outlook.MailItem Dim email As Outlook.MailItem oMail = CType(oOutL.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem) Dim MsgFileName As String MsgFileName = ChangeToSharedPath(gsDatabaseNames(iThisDatabase)) email = oMail.Application.Session.OpenSharedItem(MsgFileName) With email AllOfMSGPreserveCase = .SenderName & .SentOn & .To & .CC & .BCC & .Subject & .Body AllOfMSGPreserveCase &= AttachmentsList End With




Reply With Quote
