【发布时间】:2010-11-14 17:42:42
【问题描述】:
我正在使用 webDAV 和 .Net 2.0 在运行 Exchange Server 2003 的服务器上收集有关电子邮件帐户的信息。我可以访问如下所示的 uri:
http://my.mailserver.com/exchange/user/Inbox/someImportantEmail.EML
我试图像这样复制文件:
Dim uri As New Uri(uriNode.InnerText)
If uri.IsFile() Then
Dim fn As String = Path.GetFileName(uri.LocalPath)
System.IO.File.Copy(uri.LocalPath, "c:\" & fn)
End If
但是 uri.IsFile() 总是返回 false。我注意到的另一件事是 uri.Local 路径是
/exchange/user/Inbox/someImportantEmail.EML
我这部分的问题?如何将 .eml 文件从 Exchange 服务器复制到本地硬盘?
编辑:
我已经实施了 AnthonyWJones 的建议
Dim cred As New System.Net.CredentialCache
cred.Add(uri, "BASIC", New System.Net.NetworkCredential(_username, _password, _domain))
Dim wc As New WebClient()
wc.Credentials = cred
wc.DownloadFile(uri, "c:\testEML.EML")
虽然这确实在我的 c 驱动器上创建了 testEML.EML 文件...这里是 EML 文件的内容:
标签: c# .net asp.net vb.net webdav