views:

28

answers:

1

Hello,

I'm having a problem using a filter on a custom date in contacts.

                RDOItems Contacts = null;
                string strSearch = string.Empty;

                strSearch = AddQuotes("http://schemas.microsoft.com/mapi/string/{01234567-8901-2345-C678-901234567801}/CustomFieldString");

                strSearch += " <> '' ";

                strSearch += " AND ";
                strSearch +=  AddQuotes("http://schemas.microsoft.com/mapi/string/{01234567-8901-2345-C678-901234567802}/CustomFieldDate");
                strSearch += " < ";
                strSearch += "'2010-04-28 18:00'";                                 


                Contacts = (RDOItems)synContacts.Items.Restrict(strSearch)

When i use only the first part of the filter (CustomFieldString) i get the right contacts, but when i expand the filter with the datetime field no contacts are returned.

Thanks,

Spitje

A: 

If the named MAPI property has a string as anid (as oppoosed to an integer), there is no way to specify the property type in the DASL name, so Redemption assumes string.

If the property was added to the folder fields, the property definition will be stored in a hidden message in that folder, and you can use just the property name (CustomFieldDate) Otherwise you can you call GetIdsFromNames to figure out the property tag, "or" it with the appropriate type (PT_SYSTIME), then contruct the DASL name that looks like a regular (not named) MAPI property:

e.g. http://schemas.microsoft.com/mapi/proptag/0x80650040

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Thanks Dmitry,It's working now.
Spitje