.NET / Outlook interop and saving attachments: a mysterious except

P

psinis

Greetings,

This is a question about the .NET / Outlook interop, from a .NET novice. I’m
using C# and MS Visual Studio 2008, MS Outlook 2003 and Xobni (not sure if
that’s relevant).

QUESTION 1:
-=-=-=-=-=-=-
The code goes into my inbox, iterates over each message, and saves all
attachments to a directory. Each time I run the code, it successfully saves
approx 30 attachments but then throws an exception which I don’t understand.
Could anyone please shed some light on this?

Exception details and code are nicely formatted at:
http://forums.msdn.microsoft.com/en-US/csharpgeneral/thread/0ee08455-f9d0-45ad-a03e-b69c4417c4f7

QUESTION 2
-=-=-=-=-=-=-
In the same code, I added the following two lines (the ultimate goal is to
strip out the sender's domain and append it to the filename of each
attachment).
However, my app freezes when I request the MailItem.SenderEmailAddress
property.


Console.WriteLine("Title: {0}", item.Subject); // this one works fine
Console.WriteLine("Email: {0}", item.SenderEmailAddress); // this one freezes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top