D
demausdauth
I have a Windows Application that fills a grid on a form getting the
read/unread items from the installed Outlook application. I am using VS 2005
and the Outlook reference is ver 11.00 object model. This form supports
Outlook versions 2000 +
All versions except 2000 are working fine. The error we get is:
System.MissingMemberException: Public member 'SenderEmailType' on type
'MailItem' not found. etc....
This had been working for Outlook 2000 + (thanks very much to Dmitry) then I
had changed it slightly, got busy for a couple of months and now it seems to
be broken. We obviously don't have many customers using Outlook2000 .
Here is the code:
Dim oApp As Object = CreateObject("Outlook.Application")
If oApp Is Nothing Then
MessageBox.Show("To utilize Email Inbox, it is required that
MS Outlook be installed on your computer.", "Email Inbox",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Try
End If
Dim sClassComp As Object = "IPM.Note"
Dim clsReadRe As Object = "REPORT.IPM.Note.IPNRN" ' this is the
class of a read receipt
Dim clsDeliveredRe As Object = "REPORT.IPM.Note.DR" ' this is
the class of delivery receipt
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI")
Dim oInbox As Outlook.MAPIFolder =
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
Dim oItems As Outlook.Items = oInbox.Items
If Not chkAllItems.Checked Then
oItems = oItems.Restrict("[Unread] = true")
End If
Dim oMsg As Object
For i As Integer = 1 To oItems.Count
getExchange = False
oMsg = oItems.Item(i)
Select Case oMsg.MessageClass.ToString.ToUpper
Case "IPM.NOTE" 'email message
If Not (oMsg.Subject Is Nothing And oMsg.To Is
Nothing And oMsg.SenderName Is Nothing) Then
Dim strFrom As String = ""
drTemp = dtInBox.NewRow
If oMsg.SenderEmailType = "EX" Then
strFrom = oMsg.SenderName
getExchange = True
Else
strFrom = oMsg.SenderName & " " &
oMsg.SenderEmailAddress
End If
drTemp.Item("Subject") = oMsg.Subject
drTemp.Item("From") = strFrom
drTemp.Item("TimeReceived") = oMsg.ReceivedTime
drTemp.Item("Body") = oMsg.Body
drTemp.Item("To") = oMsg.To
drTemp.Item("CC") = oMsg.CC
drTemp.Item("EntryID") = oMsg.EntryID
drTemp.Item("StoreID") = oMsg.Parent.StoreID
drTemp.Item("EX") = getExchange
If oMsg.Attachments.Count > 0 Then
drTemp.Item("Attachments") = 1
Else
drTemp.Item("Attachments") = 0
End If
dtInBox.Rows.Add(drTemp)
End If
Case "REPORT.IPM.NOTE.DR" 'delivery notice
Dim strHappy As String
strHappy = ""
Case "REPORT.IPM.NOTE.IPNRN" 'read receipt
Dim strHappy As String
strHappy = ""
End Select
Next
The main question is why am I now getting an error when I check for the
SenderEmailType?
read/unread items from the installed Outlook application. I am using VS 2005
and the Outlook reference is ver 11.00 object model. This form supports
Outlook versions 2000 +
All versions except 2000 are working fine. The error we get is:
System.MissingMemberException: Public member 'SenderEmailType' on type
'MailItem' not found. etc....
This had been working for Outlook 2000 + (thanks very much to Dmitry) then I
had changed it slightly, got busy for a couple of months and now it seems to
be broken. We obviously don't have many customers using Outlook2000 .
Here is the code:
Dim oApp As Object = CreateObject("Outlook.Application")
If oApp Is Nothing Then
MessageBox.Show("To utilize Email Inbox, it is required that
MS Outlook be installed on your computer.", "Email Inbox",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Try
End If
Dim sClassComp As Object = "IPM.Note"
Dim clsReadRe As Object = "REPORT.IPM.Note.IPNRN" ' this is the
class of a read receipt
Dim clsDeliveredRe As Object = "REPORT.IPM.Note.DR" ' this is
the class of delivery receipt
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI")
Dim oInbox As Outlook.MAPIFolder =
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
Dim oItems As Outlook.Items = oInbox.Items
If Not chkAllItems.Checked Then
oItems = oItems.Restrict("[Unread] = true")
End If
Dim oMsg As Object
For i As Integer = 1 To oItems.Count
getExchange = False
oMsg = oItems.Item(i)
Select Case oMsg.MessageClass.ToString.ToUpper
Case "IPM.NOTE" 'email message
If Not (oMsg.Subject Is Nothing And oMsg.To Is
Nothing And oMsg.SenderName Is Nothing) Then
Dim strFrom As String = ""
drTemp = dtInBox.NewRow
If oMsg.SenderEmailType = "EX" Then
strFrom = oMsg.SenderName
getExchange = True
Else
strFrom = oMsg.SenderName & " " &
oMsg.SenderEmailAddress
End If
drTemp.Item("Subject") = oMsg.Subject
drTemp.Item("From") = strFrom
drTemp.Item("TimeReceived") = oMsg.ReceivedTime
drTemp.Item("Body") = oMsg.Body
drTemp.Item("To") = oMsg.To
drTemp.Item("CC") = oMsg.CC
drTemp.Item("EntryID") = oMsg.EntryID
drTemp.Item("StoreID") = oMsg.Parent.StoreID
drTemp.Item("EX") = getExchange
If oMsg.Attachments.Count > 0 Then
drTemp.Item("Attachments") = 1
Else
drTemp.Item("Attachments") = 0
End If
dtInBox.Rows.Add(drTemp)
End If
Case "REPORT.IPM.NOTE.DR" 'delivery notice
Dim strHappy As String
strHappy = ""
Case "REPORT.IPM.NOTE.IPNRN" 'read receipt
Dim strHappy As String
strHappy = ""
End Select
Next
The main question is why am I now getting an error when I check for the
SenderEmailType?