G
Guest
Hi,
I wrote the following codes to read messages. They work fine for Outlook
2002 but fails for 2003. My felling it may be a bug of Outlook 2003. Anybody
has experience on that? Thanks in advance
Dim oOutlook As Outlook.Application
Dim oNS As Outlook.NameSpace
Dim oStores As Outlook.Folders
Dim oStore As Outlook.MAPIFolder
Dim oFolders As Outlook.Folders
Dim oFolder As Outlook.MAPIFolder
Dim oMsgs As Outlook.Items
oOutlook = New Outlook.Application
oNS = oOutlook.Session
oNS.Logon(ShowDialog:=False, NewSession:=False)
oStores = oNS.Folders
oStore = oNS.Folders.GetFirst()
oFolders = oStore.Folders
oFolder = oFolders.Item("Inbox")
oMsgs = oFolder.Items
Try
' if message class is 'IPM.Note.SMIME' failed at below line
Dim oMsg As Outlook.MailItem = oMsgs.GetFirst ' only for 'IPM.Note' message
Dim oMsg As Object = oMsgs.GetFirst ' only for 'IPM.Note.SMIME' message
Debug.WriteLine(oMsg.Subject)
Debug.WriteLine(oMsg.MessageClass)
Debug.WriteLine(oMsg.Class)
' if message class is 'IPM.Note.SMIME' failed at below line
Debug.WriteLine(CStr(oMsg.ReceivedTime))
Debug.WriteLine("-----------------------")
Catch ex As Exception
Debug.WriteLine(ex.Message.ToString)
End Try
oNS.Logoff()
I wrote the following codes to read messages. They work fine for Outlook
2002 but fails for 2003. My felling it may be a bug of Outlook 2003. Anybody
has experience on that? Thanks in advance
Dim oOutlook As Outlook.Application
Dim oNS As Outlook.NameSpace
Dim oStores As Outlook.Folders
Dim oStore As Outlook.MAPIFolder
Dim oFolders As Outlook.Folders
Dim oFolder As Outlook.MAPIFolder
Dim oMsgs As Outlook.Items
oOutlook = New Outlook.Application
oNS = oOutlook.Session
oNS.Logon(ShowDialog:=False, NewSession:=False)
oStores = oNS.Folders
oStore = oNS.Folders.GetFirst()
oFolders = oStore.Folders
oFolder = oFolders.Item("Inbox")
oMsgs = oFolder.Items
Try
' if message class is 'IPM.Note.SMIME' failed at below line
Dim oMsg As Outlook.MailItem = oMsgs.GetFirst ' only for 'IPM.Note' message
Dim oMsg As Object = oMsgs.GetFirst ' only for 'IPM.Note.SMIME' message
Debug.WriteLine(oMsg.Subject)
Debug.WriteLine(oMsg.MessageClass)
Debug.WriteLine(oMsg.Class)
' if message class is 'IPM.Note.SMIME' failed at below line
Debug.WriteLine(CStr(oMsg.ReceivedTime))
Debug.WriteLine("-----------------------")
Catch ex As Exception
Debug.WriteLine(ex.Message.ToString)
End Try
oNS.Logoff()