从特定的文件夹中获取Outlook中的所有邮件

| 我想从特定的文件夹中获取Outlook中的所有邮件: 我的文件夹结构: 我找到此代码来获取Outlook收件箱文件夹中的所有邮件(而不是图片中的收件箱!):
Outlook.Application oApp;
Outlook._NameSpace oNS;
Outlook.MAPIFolder oFolder;
Outlook._Explorer oExp;

oApp = new Outlook.Application();
oNS = (Outlook._NameSpace)oApp.GetNamespace(\"MAPI\");
oFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
oExp = oFolder.GetExplorer(false);
oNS.Logon(Missing.Value, Missing.Value, false, true);

Outlook.Items items = oFolder.Items;
foreach (Outlook.MailItem mail in items)
{
    //do someting
}
有人可以告诉我如何从特定文件夹(例如:wolfy-server)中获取所有邮件吗?     
已邀请:
这应该工作!!!
MAPIFolder mailsFromThisFolder;

MAPIFolder mainFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

foreach (MAPIFolder folder in mainFolder.Folders)
{
    GetFolders(folder);
}

public void GetFolders(MAPIFolder folder)
{
    if (folder.Folders.Count == 0)
    {
            if (folder.Name == \"Folder Name\")
            {
                Console.WriteLine(m.FullFolderPath);
                mailsFromThisFolder = folder;
            }
    }
    else
    {
         foreach (MAPIFolder subFolder in folder.Folders)
         {
              GetFolders(subFolder);
         }
    }
}

Outlook.Items items = mailsFromThisFolder.Items;
foreach (Outlook.MailItem mail in items)
{
    //do someting
}
    
必须先登录,然后再执行其他操作。 使用如下内容 oFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox); oSubfolder = oFolder.Folders.Item(\“ wolfy-server \”);     

要回复问题请先登录注册