outlookoffice-addinsoutlook-web-addinsoutlook-redemption

Cannot get Redemption's RDOItems.Find API to work


I'm trying to retrieve a HiddenItem without having to iterate through the HiddenItem collection.

Unfortunately, I ended up iterating through the collection and checking the MessageClass of each item in order to get the message I wanted.

internal class Program
{
    private static RDOSession rdoSession;
    private static readonly string DASL = "http://schemas.microsoft.com/mapi/proptag/0x7C080102";
    static void Main(string[] args)
    {
        rdoSession = RedemptionLoader.new_RDOSession();
        rdoSession.Logon();

        try
        {
            RDOFolder inbox = rdoSession.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);
            RDOItems hiddenItems = inbox.HiddenItems;
            
            // This line throws "System.ArgumentException
            //{"Unknown property name: sql"}
            RDOMail mail = hiddenItems.Find("@SQL=\"http://schemas.microsoft.com/mapi/proptag/0x001A001E\"");
           
            int rowCount = hiddenItems.Count;

            for (int i = 1; i < rowCount; i++)
            {
                
                RDOMail mailItem = hiddenItems[i];

                if (mailItem.MessageClass == "IPM.Configuration.ExtensionMasterTable")
                {
                    object [] p = hiddenItems[i].Fields[DASL];


                    int len = p.Length;

                    byte[] data = new byte[len];

                    for( int index=0; index < len; index++ )
                    {
                        data[index] = (byte)p[index];
                    }

                    string result = System.Text.Encoding.UTF8.GetString(data);

                }
            }                                
        }
        catch (Exception e)
        {
            System.Diagnostics.Debug.WriteLine(e);
        }
        finally
        {

            rdoSession.Logoff();
        }
    }
}

Solution

  • Use a query like

    RDOMail mail = hiddenItems.Find("\"http://schemas.microsoft.com/mapi/proptag/0x001A001E\" = 'IPM.Configuration.ExtensionMasterTable' ");
    

    or

    RDOMail mail = hiddenItems.Find("MessageClass = 'IPM.Configuration.ExtensionMasterTable' ");