Using Find to find a user property in Outlook/Redemption

0

I'm trying to return a single calendaritem from Outlook from our C# windows desktop application. It keeps returning this error: Redemption.RDOItems Assertion failed: Number of fields == 1.

I use similar code in an Outlook addin I created and it works fine. The main difference is the filterprefix. In the AddIn I use:

string filterprefix = "[" +  OurCustomProperty.OurItemId + "] = '";  
var filter1 = filterprefix + parentItem.NeedlesId + "'";
var findItem = folder.Items.Find(filter1);

but this code does not work from our desktop app.

Here is the code from the desktop App which is returning the error:

The appointment.Id contains a valid value which we set when we create the item.

string Filterprefix = "@SQL="+"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/OurCustomProperty.OurItemId/0x0000001f = '";
RDOSession rdoSession = new RDOSession();
rdoSession.Logon("", "", false, false, null, false);

RDOFolder folderRDO = rdoSession.GetDefaultFolder(rdoDefaultFolders.olFolderCalendar);

var filter1 = filterprefix + appointment.Id + "'";
string ls_find = Filterprefix +  appointment.Id + "'" ;
var findItem = folderRDO.Items.Find(ls_find);

I've tried several variations of the syntax but can't seem to get it right. I also tried using Sort then Restrict but no luck with that either.

Thanks, Rick

outlook
find
outlook-redemption
asked on Stack Overflow Apr 15, 2019 by Rick Harris • edited Dec 14, 2019 by ldz

1 Answer

0

RDOItems.Find takes a SQL statement, please do not use the @SQL= prefix - it is OOM specific. Also do not forget to doublequote the DASL property name:

"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/OurCustomProperty.OurItemId/0x0000001f" = '<some value>'
answered on Stack Overflow Apr 16, 2019 by Dmitry Streblechenko • edited Apr 17, 2019 by Dmitry Streblechenko

User contributions licensed under CC BY-SA 3.0