1

I have a piece of code that uses DASL queries to query values saved in the user property of items in an RDOFolder, something like this: rdoFolder.Items.Find("\"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyUserPropertyName/0x0000001F\"='queryValue'" However, now I need to migrate data saved in my user properties into the Field property of RDOMail item. I'd like to know if there's a similar way to query this Field property for fast performance. Looping through all items in the folder to do a value comparison could be very slow when there are tens of thousands of items.

Rachel
  • 13
  • 3

2 Answers2

0

You can pass the same DASL name to the RDOMail.Fields indexed property.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • I'm having a similar issue. Did you mean that you can do something like this: `rdoMail.Fields["\"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyUserPropertyName/0x0000001F\"='queryValue'"]`? Even if you can do this, doesn't the code still need to loop through all items in a particular folder and perform the above query on all fields of each item? – Leon Zhou Sep 26 '16 at 23:22
  • 1
    You can do `rdoMail.Fields["http://schemas.microsoft.com/mapi/string/{‌​00020329-0000-0000-C‌​000-000000000046}/My‌​UserPropertyName/0x0‌​000001F"]`. Since the question is about a particular RDOMail object, yes, it must be opened first. If you want to query multiple items in a single call RDOFolder.Items.Find/FindNext/Restrict or ExecSQL are the way to go. – Dmitry Streblechenko Sep 27 '16 at 05:10
0

I found that the RDOFolder.Items.Find method also searches values saved via the RDOMail.Fields index property. Just as what Dmitry said in his comment.

For example, if I set the value like this:

myRdoMail.Fields["http://schemas.microsoft.com/mapi/string/{8d736f90-8f45-4591-81aa-c85a98f1261b}/MyUserProperty"] = "MyValue";

Then I'll be able to find this item by doing the following:

var result = myRdoFolder.Items.Find("\"http://schemas.microsoft.com/mapi/string/{8d736f90-8f45-4591-81aa-c85a98f1261b}/MyUserProperty\"='MyValue'");
Leon Zhou
  • 633
  • 6
  • 20