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

Tech-Archive recommends: Fix windows errors by optimizing your registry



Regarding your second issue, SenderEmailAddress is a property blocked by
Outlook's "object model security guard." See
http://outlookcode.com/article.aspx?ID=52 for your options. Because you
apparently are not building an add-in, I'd recommend using Redemption.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx



"psinis" wrote:

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



.



Relevant Pages