【发布时间】:2014-09-03 23:12:31
【问题描述】:
我正在尝试从 outlookmail 正文中的超链接保存 Word 文档。
m 是邮件;
try
{
string s;
System.Net.WebClient wc = new System.Net.WebClient();
Word.Hyperlink wlink = null;
if (m.GetInspector.IsWordMail())
{
Word.Document oDoc = m.GetInspector.WordEditor;
Word.Hyperlinks links = oDoc.Hyperlinks;
for (int j = 1; j <=links.count(); j++)
{
object index = (object)j;
if (links.get_Item(ref index).Address.Contains("format=msw"))
{
wlink = links.get_Item(ref index);
s = wlink.Address;
wc.DownloadFile(s, AppSettings.Default.savefolderpath + filename + " Word.docx");
index = null;
break;
}
}
}
}
我收到以下错误: 尝试的操作失败。找不到对象。在 Microsoft.Office.Interop.Outlook.FoldersClass.get_Item(对象索引)
【问题讨论】:
-
有没有其他方法可以使用邮件中的超链接下载文档
标签: c#-4.0 outlook automation