Office.Interop.Outlook访问子文件夹 [英] Office.Interop.Outlook accessing sub-folders
问题描述
我正在编写一个使用Microsoft Outlook库访问某些文件夹的应用程序。我有一个问题,我可以打开命名空间并获取默认的收件箱文件夹,但每当我尝试访问基础文件夹时,我收到错误:
I am writing an application that uses Microsoft Outlook libraries to access some folders. I have a problem where I can open up the namespace and get the default Inbox folder but whenever I try to access the underlying folders I get the error:
[System.Runtime.InteropServices.COMException] {"Interface not registered (Exception from HRESULT: 0x80040155)"}
我能够获得 unreadItemcounts
并查看收件箱的属性。我使用的代码是:
I am able to get unreadItemcounts
and view the properties of the Inbox. The code that I am using is:
appOutlook = new Outlook.Application();
nsOlApp = appOutlook.GetNamespace("MAPI");
nsOlApp.Logon(Type.Missing,Type.Missing, true, true);
// nsOlApp.Logon(Type.Missing, Type.Missing, Type.Missing, Type.Missing);
oFolder = nsOlApp.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
foreach (Outlook.MAPIFolder fldr in oFolder.Folders)
{
MessageBox.Show(fldr.Name.ToString());
}
还有其他人有这个问题吗?
我已经成功注册了ole32.dll,并且必须使用Outlook库,因为我需要访问特定应用程序的收件箱中的子文件夹。
谢谢
Has anyone else had this problem?
I have registered ole32.dll successfully and must use Outlook libraries as I need to access sub-folders int he inbox for a particular application.
thanks
推荐答案
以下是此错误的检查点:
Following are the checkpoints for this error:
- 您应该使用
Interop.excel.Dll
。Excel.Exe
库会出现此错误。以0x8
开头的错误是权限错误或指向内存的无效指针。 - 转到 - >开始 - >跑 - >输入
REGSVR32 OLE32.DLL
- > OK
这将显示消息:ole32.dll成功
- You should be using the
Interop.excel.Dll
. theExcel.Exe
library will give this error. Errors starting with0x8
are permission errors or invalid pointer to memory. - Go to --> Start --> run --> Enter
REGSVR32 OLE32.DLL
--> OK
This will show the message :ole32.dll succeeded
嗨Amit
感谢您的回复。我已成功注册ole32.dll但仍有问题。我确实认为存在无效的内存问题,但它可能与缺失有关,就像实例化我错过的东西一样。我们非常欢迎任何其他想法。
Hi Amit
Thanks for your response. I have registered ole32.dll successfully and still have the problem. I do think that there is an invalid memory problem but it could be to do with a missing like that instantiates something that I have missed. Any other ideas are really welcome.
这篇关于Office.Interop.Outlook访问子文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!