我目前正在制作一个需要分析 Outlook 2007 和 Outlook 2010 中的邮件消息的程序。
在安装了办公套件的机器上,它可以正常工作。如果他们只有 Outlook,它似乎无法获取邮件,当我尝试获取文档的内容时,它给了我以下错误:
"Unable to cast COM object of type
'Microsoft.Office.Interop.Word.DocumentClass' to interface type
'Microsoft.Office.Interop.Word._Document'. This operation failed because the
QueryInterface call on the COM component for the interface with IID '{0002096B-0000-
0000-C000-000000000046}' failed due to the following error: No such interface supported
(Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."
这是我用来获取消息的代码:
Office.Word.Document document = inspector.WordEditor as Office.Word.Document;
string body = document.Content.Text;