Outlook-Addin:使用 Exchange-Online 时如何快速检索文件夹树

Outlook-Addin: How to retrive folder tree fast when Exchange-Online is used

我正在使用 Outlook Redemption library

我正在尝试检索 Outlook 存储的文件夹列表。我只需要满足某些条件的文件夹,只需要它们的 nameDefaultMessageClass.

当使用没有缓存的 Exchange 帐户时,RDOFolder 对象的迭代非常慢。

所以我尝试使用 GetAllChildFolders() 并将其与 RODFolderItems find 方法组合。

http://www.dimastr.com/redemption/RDOFolders.htm

var allFolder = ((RDOFolder2)rootFolder).GetAllChildFolders();

string folderSelect = "SELECT Name, EntryId, DefaultMessageClass FROM  FOLDER WHERE \"http://schemas.microsoft.com/mapi/proptag/0x3613001F\" like '%Note%'";

try
{
RDOFolder vFolder = vFolders.Find(folderSelect);


  while (vFolder != null)
  {
    System.Diagnostics.Debug.WriteLine(vFolder.Name);
    System.Diagnostics.Debug.WriteLine(vFolder.EntryID);
    System.Diagnostics.Debug.WriteLine(vFolder.DefaultMessageClass);

    vFolder = vFolders.FindNext();

   }
}
catch (Exception ex)
{
    //log error here!
}

现在我有两个问题!

1. SQL语法

来自 find 方法的文档

The properties specified in the SQL query must either use the Outlook Object Model (or RDO) property name (e.g. Subject, Email1Address)

我无法使 Outlook 或 Redemption 属性在 SQL 语句中起作用。有人有工作示例吗?

2。性能访问属性

联机文档说明如下。

Including the SELECT clause allows Redemption to pre-fetch the properties from the folder hierarchy table without opening the item resulting in a significant performance gain (see example "I wish there was one :-)"). If you later access a property not specified in the SELECT clause, Redemption will open the item.

如何从文件夹层次结构中访问属性预取? 如果我使用 RDOFolder.Name,整个文件夹对象都会打开,并且不会有太大的性能提升。

  1. 哪些属性不起作用?您是否收到特定错误?

  2. 您的完整 SELECT 陈述是什么?为避免打开文件夹的机会,请使用 RDOFolders.MAPITable.ExecSQL - 它会 return 一个 ADODB.Recordset 对象。