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 / October 2004

Tip: Looking for answers? Try searching our database.

Bug in Office Interop using SaveAs?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jediah L. - 27 Oct 2004 04:55 GMT
The following code snippet fails when trying to save a mailitem to a windows
folder:

I've tried many variations of path - If i supply a file name I get an
"Invalid Parameter" error - so i'm pretty sure it just wants path - and when
I supply path (with \ or without \ as the last char) this is the error when
I get.

Here is an example of the code:

if(oItem is Outlook.MailItem)
{

Outlook.MailItem oMailItem = oItem as Outlook.MailItem;

oMailItem.SaveAs(path, OlItemType.olMailItem);

}

The error is:

{@"Can't write to file: c:\temp\outlook\Inbox\discover\testfolder.
Right-click the folder that contains the file you want to write to, and then
click Properties on the shortcut menu to check your permissions for the
folder." }

I checked the folder - and it is set readonly - I uncheck and apply - and
check the property again - and it is once again read only.

I only have problems writing to the folder through outlook and the interop -
I can write through the file system object - or manually through explorer,
or even through outlook directly....

I found this article which seems to explain perhaps why I can't remove the
'readonly' setting:

http://www.winnetmag.com/Article/ArticleID/24940/24940.html

But still doesn't explain why outlook is the only program that has a problem
with that value...

Any help would be appreciated!
Jediah L. - 27 Oct 2004 18:17 GMT
Well it appears the bug was partially my fault. :)

The Path does need to include the file name, for some reason, the second
parameter would not accept any of the valid values except Missing.Value...

Once I stopped trying to dictate what type of item was being saved - it
stopped throwing the "Invalid Parameter" error - and once I started
specifying the file name - it stopped throwing the "Read Only" error.

Additionally - research seems to suggest that Folders are always set "Read
Only" in XP.. oh well.. :)

> The following code snippet fails when trying to save a mailitem to a
> windows folder:
[quoted text clipped - 38 lines]
>
> Any help would be appreciated!
"Peter Huang" - 28 Oct 2004 03:21 GMT
Hi,

Cheers!
It seems that the problem has been resolved.
If you still have any concern on this issue, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Rate this thread:







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.