A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook Automation Problem using Microsoft.Office.Interop.Outlook



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old February 10th 09, 12:25 AM posted to microsoft.public.outlook.program_forms
DP
external usenet poster
 
Posts: 19
Default Outlook Automation Problem using Microsoft.Office.Interop.Outlook

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.Out look.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(iCellCoun ter).Value =
oMsgm.SenderName
Me.DataGridView1.Rows(iRowCounter).Cells(iCellCoun ter + 1).Value =
oMsgm.Subject
Me.DataGridView1.Rows(iRowCounter).Cells(iCellCoun ter + 2).Value =
oMsgm.ReceivedTime
Me.DataGridView1.Rows(iRowCounter).Cells(iCellCoun ter + 3).Value =
oMsgm.ConversationIndex

Pause()

iRowCounter += 1
Case Else
End Select
Next i

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
search remote calendars with Microsoft.Office.Interop.Outlook 11 entvex Outlook - General Queries 1 January 28th 09 03:03 PM
Hot to get propetyInfo of Microsoft.Office.Interop.Outlook.MailIte Jongmin Outlook - Using Forms 1 October 16th 08 03:47 PM
Unable to cast object of type 'System.__ComObject' to type 'Microsoft.Office.Interop.Outlook.ApplicationClass' John Yovas Add-ins for Outlook 2 September 12th 08 05:23 PM
How to get Microsoft.Office.Interop.Outlook.TaskItem from the IUnknown (C#) Godandag Add-ins for Outlook 5 April 5th 07 10:39 AM
Msdn help for Microsoft.Office.Interop.Outlook members DavidE Add-ins for Outlook 0 August 9th 06 08:45 AM


All times are GMT +1. The time now is 01:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.