我正在尝试从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(对象索引)
答案 0 :(得分:0)
您确定在代码片段中引发了错误吗?看起来您正在按名称访问文件夹,但它不存在:MAPIFolder.Folders("I do not exist")