469,925 Members | 1,519 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,925 developers. It's quick & easy.

Integration with Outlook 2000 Saving an email as RTF file.

I am trying to loop thru Inbox and select any one email and save it as
a RTF file. Here is the code I am using

Outlook.Explorer myOutlookExplorer =
myOutlookApp.Explorers.Add(myOutlookNamespace.GetD efaultFolder(Outlook.OlDefaultFolders.olFolderInbo x),
Outlook.OlFolderDisplayMode.olFolderDisplayNormal) ;
myOutlookExplorer.Activate();
Outlook.MailItem myMailItem = (Outlook.MailItem)
myOutlookExplorer.CurrentFolder.Items.Item(1);
myMailItem.SaveAs("D:\temp.rf", OlSaveAsType.olRTF);
This is the error message I am getting .

Additional information: Could not complete the operation. One or more
parameter values are not valid.

Any suggestions will be appreciated.

Thanks
Nov 15 '05 #1
3 4035
Krishna,

It could be the string that you are using to save the file to. The
following string:

"D:\temp.rf"

Is actually interpreted as follows:

"D:<tab>emp.rf"

Which is probably the root of the problems. The "\" character is the
escape character and interprets the next character after it in a special
manner. To get around this, you can do the following:

"D:\\temp.rf"

Or:

@"D:\temp.rf"

The @ sign means to interpret the string literally.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldino=at=exisconsulting<dot>com

"Krishna" <Ki****@yahoo.com> wrote in message
news:8c**************************@posting.google.c om...
I am trying to loop thru Inbox and select any one email and save it as
a RTF file. Here is the code I am using

Outlook.Explorer myOutlookExplorer =
myOutlookApp.Explorers.Add(myOutlookNamespace.GetD efaultFolder(Outlook.OlDef
aultFolders.olFolderInbox), Outlook.OlFolderDisplayMode.olFolderDisplayNormal) ;
myOutlookExplorer.Activate();
Outlook.MailItem myMailItem = (Outlook.MailItem)
myOutlookExplorer.CurrentFolder.Items.Item(1);
myMailItem.SaveAs("D:\temp.rf", OlSaveAsType.olRTF);
This is the error message I am getting .

Additional information: Could not complete the operation. One or more
parameter values are not valid.

Any suggestions will be appreciated.

Thanks

Nov 15 '05 #2
Krishna,

It could be the string that you are using to save the file to. The
following string:

"D:\temp.rf"

Is actually interpreted as follows:

"D:<tab>emp.rf"

Which is probably the root of the problems. The "\" character is the
escape character and interprets the next character after it in a special
manner. To get around this, you can do the following:

"D:\\temp.rf"

Or:

@"D:\temp.rf"

The @ sign means to interpret the string literally.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldino=at=exisconsulting<dot>com

"Krishna" <Ki****@yahoo.com> wrote in message
news:8c**************************@posting.google.c om...
I am trying to loop thru Inbox and select any one email and save it as
a RTF file. Here is the code I am using

Outlook.Explorer myOutlookExplorer =
myOutlookApp.Explorers.Add(myOutlookNamespace.GetD efaultFolder(Outlook.OlDef
aultFolders.olFolderInbox), Outlook.OlFolderDisplayMode.olFolderDisplayNormal) ;
myOutlookExplorer.Activate();
Outlook.MailItem myMailItem = (Outlook.MailItem)
myOutlookExplorer.CurrentFolder.Items.Item(1);
myMailItem.SaveAs("D:\temp.rf", OlSaveAsType.olRTF);
This is the error message I am getting .

Additional information: Could not complete the operation. One or more
parameter values are not valid.

Any suggestions will be appreciated.

Thanks

Nov 15 '05 #3
I tried this still does not work.

Thanks
-----Original Message-----
If this is literally your C# code then this is one problem:
myMailItem.SaveAs("D:\temp.rf",
change to:

myMailItem.SaveAs("D:\\temp.rtf",

--Richard

-----Original Message-----
I am trying to loop thru Inbox and select any one email

and save it as
a RTF file. Here is the code I am using

Outlook.Explorer myOutlookExplorer =
myOutlookApp.Explorers.Add

(myOutlookNamespace.GetDefaultFolder
(Outlook.OlDefaultFolders.olFolderInbox),
Outlook.OlFolderDisplayMode.olFolderDisplayNorma l);
myOutlookExplorer.Activate();
Outlook.MailItem myMailItem =

(Outlook.MailItem)
myOutlookExplorer.CurrentFolder.Items.Item(1);
myMailItem.SaveAs("D:\temp.rf",

OlSaveAsType.olRTF);


This is the error message I am getting .

Additional information: Could not complete the

operation.One or more
parameter values are not valid.

Any suggestions will be appreciated.

Thanks
.

.

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Fritz Switzer | last post: by
3 posts views Thread by Kurt | last post: by
1 post views Thread by Rob | last post: by
2 posts views Thread by Ronnie | last post: by
reply views Thread by RBrady | last post: by
10 posts views Thread by John | last post: by
2 posts views Thread by Karen Grube | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.