开发者

Redemption using filter on a custom datetime field in contacts

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 contact开发者_StackOverflow中文版s, but when i expand the filter with the datetime field no contacts are returned.

Thanks,

Spitje


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜