Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / July 2008

Tip: Looking for answers? Try searching our database.

Add-in not reading message

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peg - 21 Jul 2008 23:33 GMT
I developed an addin for Outlook 2003 using c#. Everything was working fine
until our company outsourced Exchange. When I tried to read a message body, I
got either a blank or error.

I have a work-around in place where I display the mail in the inspector
window, read the text and then close the window. This works, but takes longer
and has a flash of the open window for the user to see. This also changes the
'read' status of the email to read and I cannot change it to unread.

Any thoughts on another solution?
Signature

Peg

Ken Slovak - [MVP - Outlook] - 22 Jul 2008 14:25 GMT
That sounds very odd. Are you still using mailboxes? Using cached mode?

What's your code for reading an item in an Explorer?

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm

>I developed an addin for Outlook 2003 using c#. Everything was working fine
> until our company outsourced Exchange. When I tried to read a message
[quoted text clipped - 9 lines]
>
> Any thoughts on another solution?
Peg - 22 Jul 2008 15:25 GMT
We are still using mailboxes. Most of our users have pst files but some keep
their mail on the server and use cached exchange mode.

here is my code for obtaining the message:
...
Outlook.MailItem mi = obj as Outlook.MailItem;
...
mi.Display(false);
...
sNewComments = mi.Body;
...
mi.Close(OlInspectorClose.olSave)
...

There is a lot more of course, so if you need it I do not think you want it
posted in this forum
Signature

Peg

> That sounds very odd. Are you still using mailboxes? Using cached mode?
>
[quoted text clipped - 13 lines]
> >
> > Any thoughts on another solution?
Ken Slovak - [MVP - Outlook] - 22 Jul 2008 21:14 GMT
The code you show doesn't look like a problem.

Is the mail item displaying?

If it does display does it show the body in the UI?

Do you get Body if you wait a while after opening the item before you read
body?

What about using similar code in the Outlook VBA project, does that work?

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm

> We are still using mailboxes. Most of our users have pst files but some
> keep
[quoted text clipped - 14 lines]
> it
> posted in this forum
Peg - 22 Jul 2008 21:36 GMT
I did not used to have to call display -- I only needed to do that when we
outsourced. At that time we also went from Exchange 2000 here to Exchange
2003 at the outsourcer's site. We also went from using VB6 (not VBA) to .Net
and C# to address the security issues.

So the mail item is displaying and the mail is getting marked as read. I was
hoping not to use similar code but to go back to getting the body without
displaying the UI. I also want to be able to update and distribute that
update and VBA is not a good option for that.

I do not know if this helps, but I get all of the header with no problem, so
I only need to display the ones that need to be saved in our database.
Signature

Peg

> The code you show doesn't look like a problem.
>
[quoted text clipped - 25 lines]
> > it
> > posted in this forum
Ken Slovak - [MVP - Outlook] - 23 Jul 2008 14:47 GMT
I suggested using VBA as a test, not for your code deployment. I'd suggest
seeing if you still have the same problem without displaying the item using
equivalent VBA code, which would tend to suggest a timing problem.

.NET code is slower than VB6 code to startup (JIT compilation, starting the
CLR) and to run since everything is effectively late bound and has to pass
through the Interop before your code even gets to work on things. So some
timing issues you might never see in unmanaged code might appear in managed
code. Thus my suggestion about seeing if delaying reading the body might
help.

Another thing you might try, depending on your Outlook version which you
don't mention, is to look at the DownloadState property of the item before
attempting to read the Body. Make sure that's OlDownloadState.olFullItem.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm

>I did not used to have to call display -- I only needed to do that when we
> outsourced. At that time we also went from Exchange 2000 here to Exchange
[quoted text clipped - 11 lines]
> so
> I only need to display the ones that need to be saved in our database.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.