Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / July 2004

Tip: Looking for answers? Try searching our database.

Problem Saving attachments from Outlook to files

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
erniej - 14 Jul 2004 07:55 GMT
I am experiencing what appears to be a security problem when attempting to save file attachments from MailItems in the default inbox of Outlook  (have tried both 2000 and 2002 SP-1).   the messages have been filtered to only save .txt attachments and I use the following code to attempt the save (myPath has been verified to exist)

mi = (Outlook.MailItem)InBox.Items.Item(x);
mi.Attachments.Item(z).SaveAsFile(myPath);

The error thrown is
'System.Runtime.InteropServices.COMException' occurred in OutlookTest.exe
Additional information: Cannot save the attachment. Access is denied'

The user is able to save the .txt files manually from within Outlook so I am not sure which security permissions are blocking this functionality.  Any assistance would be greatly appreciated.

Cheers

Ernie
erniej - 15 Jul 2004 01:01 GMT
For anyone interested - I have found a solution.

The documentation indicates that the SaveAsFile() method takes a path string as its parameter.  i.e.  mi.Attachments.Item(z).SaveAsFile(myPath);

It actually requires the path + filename.   Otherwise you get the Access Denied error - leading you to think there is a security issue.

Found this thanks to a forum thread on www.outlookcode.com
(http://www.outlookcode.com/threads.aspx?forumid=5&messageid=5371)

Cheers

Ernie

> I am experiencing what appears to be a security problem when attempting to save file attachments from MailItems in the default inbox of Outlook  (have tried both 2000 and 2002 SP-1).   the messages have been filtered to only save .txt attachments and I use the following code to attempt the save (myPath has been verified to exist)
>
[quoted text clipped - 10 lines]
>
> Ernie

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
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.