"Option Strict On" with Microsoft Outlook Object
Hi.
When I set "Option Strict" to On, I'm getting an error message "Option Strict On disallows implicit conversions from 'System.Object' to 'Outlook.MailItem' with the following code:
Dim oApp As New Outlook.Application
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI")
Dim oInBox As Outlook.MAPIFolder = _
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderInbox)
Dim oItems As Outlook.Items = oInBox.Items
Dim oMsg As Outlook.MailItem
The error occurs on the last line (Dim oMsg as Outlook.MailItem).
Since nothing is defined as an Object, I don't know what to do to get rid of the error message. I have a reference set to Microsoft Outlook 11.0 Object Library.
Any suggestions will be greatly appreciated.
Rita
|