0
我正在嘗試閱讀由Outlook移至雜亂文件夾的電子郵件。下面的代碼適用於其他文件夾,但是當我嘗試打開混亂文件夾時,代碼默認爲錯誤消息,表明該文件夾不存在。如何從Clutter outlook文件夾中讀取電子郵件C#
oApp = new Microsoft.Office.Interop.Outlook.Application();
oNS = (Microsoft.Office.Interop.Outlook._NameSpace)oApp.GetNamespace("MAPI");
oNS.Logon(null, null, false, false);
oFolder = oNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
string folderName = "Clutter";
try
{
oSubfolder = oFolder.Folders[folderName];
for (int i = 1; i <= oSubfolder.Items.Count; i++)
{
item = (Microsoft.Office.Interop.Outlook.PostItem)oFolder.Items[i];
}
}
catch
{
MessageBox.Show("There is no folder named " + folderName +
".", "Find Folder Name");
}