I'm using Outlook Redemption library.
I am trying to retrieve the folder list of an Outlook store. I only need folders which meet a some criterias and only need their name and there DefaultMessageClass.
Iteration the RDOFolder objects is quite slow when an Exchange Account without a cached is used.
So I played around with the GetAllChildFolders() and combined it the the RODFolderItems find
method.
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!
}
Now I got two questions!
1. SQL Syntax
From the docmentation of find
method
The properties specified in the SQL query must either use the Outlook Object Model (or RDO) property name (e.g. Subject, Email1Address)
I can't make Outlook or Redemption properties work within the SQL statement. Has somebody a working example?
2. Performance access properties
The online documentation states the following.
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.
How do I access the properties prefetch from the folder hierarchy? If I use RDOFolder.Name, the whole folder object is opened and there is not much of an performance gain.