Outlook邮件附件文件使用c#windows应用程序保存。文件位置应该从csv文件获取 [英] Outlook mail Attachments files save using c# windows application . The file location should be get from csv file

查看:112
本文介绍了Outlook邮件附件文件使用c#windows应用程序保存。文件位置应该从csv文件获取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用c#windows应用程序在特定位置保存Outlook附件文件。该位置(路径)从csv文件获取。我用这个编码



I need to save outlook attachments files in particular location using c# windows application. That location(path)get from csv file. I used this coding

TargetFolder.Items[i].Attachments[1].SaveAsFile(@SaveLocation + i + " " + TargetFolder.Items[i].Attachments[1].FileName);





这里SaveLocation - 我得到了这个来自csv文件,但它显示错误,找不到文件位置。



here SaveLocation - i got this from csv file, but it shows an error, file location not found.

推荐答案

@SaveLocation的值是多少?您需要确保目录(如果它是目录)存在。您可以使用System.IO.Directory.CreateDirectory()方法来创建它。然后你可能想要使用System.IO.Path.Combine()在保存它之前基本上附加@\和文件名。
What is the value of @SaveLocation? You'll want to make sure the directory (if it is a directory) exists. You could use the System.IO.Directory.CreateDirectory() method to create it. Then you may want to use System.IO.Path.Combine() to essentially append @"\" and the file name before saving it.


这篇关于Outlook邮件附件文件使用c#windows应用程序保存。文件位置应该从csv文件获取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆