背景:
目前,我正在VSTO加载项中搜索电子邮件主题中的单词。我的语法是:
string filter = "urn:schemas:mailheader:subject LIKE \'%" + wordInSubject + "%\'";
甚至以下语法也可以:
string filter = String.Format("\"urn:schemas:mailheader:subject\" >= '{0}'", "ticket");
string filter = String.Format("@SQL=(\"urn:schemas:calendar:dtstart\" >= '{0:g}' " + "AND \"urn:schemas:calendar:dtend\" <= '{1:g}' " + "AND \"urn:schemas:mailheader:subject\" LIKE '%{2}%')", startTime, endTime, wordInSubject);
但是,我也想包括邮件在一个时间范围之间的DateTime比较。
注册链接:
我尝试了以下方法,但是它们不起作用:
string filter = ("urn:schemas:mailheader:subject LIKE \'%" + wordInSubject + "%\'") + ("[Start] >= '" + startTime.ToString("g") + "' + [End] <= '" + endTime.ToString("g") + "'");
string filter = ("urn:schemas:mailheader:subject LIKE \'%" + wordInSubject + "%\'") AND ("[Start] >= '" + startTime.ToString("g") + "' AND [End] <= '" + endTime.ToString("g") + "'");
另外,在搜索时,我读到它应该以“ @ SQL =”开头-但是,即使这种情况也会引发错误:-
string filter = "@SQL=""urn:schemas:mailheader:subject LIKE \'%" + wordInSubject + "%\'"
问题陈述:-
我不是在寻找具体的DateTime案例。但是,我只能使用在单个过滤器字符串(任何类型的条件)中使用多个条件的语法。
尝试使用DASL属性名称的以下查询:
@SQL=("http://schemas.microsoft.com/mapi/proptag/0x0E1D001F" LIKE '%test%') AND ("http://schemas.microsoft.com/mapi/proptag/0x0E060040" > '2017-09-25 00:00:00') AND ("http://schemas.microsoft.com/mapi/proptag/0x0E060040" < '2018-09-25 00:00:00')
它对PR_NORMALIZED_SUBJECT_W
(DASL name http://schemas.microsoft.com/mapi/proptag/0x0E1D001F
)和PR_MESSAGE_DELIVERY_TIME
(DASL name http://schemas.microsoft.com/mapi/proptag/0x0E060040
)使用限制。
可以在OutlookSpy中检索DASL属性名称(单击IMessage按钮,选择属性,请参见DASL文本框)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句