D
DP
Receiving message in Outlook when call interop from vb.net and trying to
read/load emails from inbox to windows form into datagridview.
Message is: The add-in "c\program files\postx\trusted messaging client for
outlook\..." could not be installed or loaded.
This message occurs at different times, never on the same email. Usually
after it loads over 150 emails. We think it is related to COM performance,
thus put in System.Threading.Thread.Sleep(100), this seems to work, but slow
to load emails.
Any input would be helpful. Here is the basic code.
Dim oAppm As Microsoft.Office.Interop.Outlook.Application = New
Microsoft.Office.Interop.Outlook.Application
Dim oInboxm As Microsoft.Office.Interop.Outlook.MAPIFolder
Dim oItemsm As Microsoft.Office.Interop.Outlook.Items
Dim oNSm As Microsoft.Office.Interop.Outlook.NameSpace =
oAppm.GetNamespace("MAPI")
oInboxm =
oNSm.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox)
oItemsm = oInboxm.Items
For i As Integer = oItemsm.Count To 1 Step -1
'Test to make sure item is a mail item and not a meeting request.
sClassComp = oItemsm.Item(i).messageclass
Select Case sClassComp
Case "IPM.Note",
"IPM.Note.Rules.ReplyTemplate.Microsoft", "IPM.Note.Secure"
Me.DataGridView1.Rows.Add()
Dim oMsgm As Microsoft.Office.Interop.Outlook.MailItem
oMsgm = TryCast(oItemsm.Item(i), Microsoft.Office.Interop.Outlook.MailItem)
iCellCounter = 0
Me.DataGridView1.Rows(iRowCounter).Cells(iCellCounter).Value =
oMsgm.SenderName
Me.DataGridView1.Rows(iRowCounter).Cells(iCellCounter + 1).Value =
oMsgm.Subject
Me.DataGridView1.Rows(iRowCounter).Cells(iCellCounter + 2).Value =
oMsgm.ReceivedTime
Me.DataGridView1.Rows(iRowCounter).Cells(iCellCounter + 3).Value =
oMsgm.ConversationIndex
Pause()
iRowCounter += 1
Case Else
End Select
Next i
read/load emails from inbox to windows form into datagridview.
Message is: The add-in "c\program files\postx\trusted messaging client for
outlook\..." could not be installed or loaded.
This message occurs at different times, never on the same email. Usually
after it loads over 150 emails. We think it is related to COM performance,
thus put in System.Threading.Thread.Sleep(100), this seems to work, but slow
to load emails.
Any input would be helpful. Here is the basic code.
Dim oAppm As Microsoft.Office.Interop.Outlook.Application = New
Microsoft.Office.Interop.Outlook.Application
Dim oInboxm As Microsoft.Office.Interop.Outlook.MAPIFolder
Dim oItemsm As Microsoft.Office.Interop.Outlook.Items
Dim oNSm As Microsoft.Office.Interop.Outlook.NameSpace =
oAppm.GetNamespace("MAPI")
oInboxm =
oNSm.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox)
oItemsm = oInboxm.Items
For i As Integer = oItemsm.Count To 1 Step -1
'Test to make sure item is a mail item and not a meeting request.
sClassComp = oItemsm.Item(i).messageclass
Select Case sClassComp
Case "IPM.Note",
"IPM.Note.Rules.ReplyTemplate.Microsoft", "IPM.Note.Secure"
Me.DataGridView1.Rows.Add()
Dim oMsgm As Microsoft.Office.Interop.Outlook.MailItem
oMsgm = TryCast(oItemsm.Item(i), Microsoft.Office.Interop.Outlook.MailItem)
iCellCounter = 0
Me.DataGridView1.Rows(iRowCounter).Cells(iCellCounter).Value =
oMsgm.SenderName
Me.DataGridView1.Rows(iRowCounter).Cells(iCellCounter + 1).Value =
oMsgm.Subject
Me.DataGridView1.Rows(iRowCounter).Cells(iCellCounter + 2).Value =
oMsgm.ReceivedTime
Me.DataGridView1.Rows(iRowCounter).Cells(iCellCounter + 3).Value =
oMsgm.ConversationIndex
Pause()
iRowCounter += 1
Case Else
End Select
Next i