Dynamics CRM:Odata查询,用于检查文件附件文件名是否包含unicode'#' [英] Dynamics CRM: Odata query that checks if the file attachment file name contains the unicode '#'
问题描述
方案:在Dynamics CRM 2011中,我有一个带有附件的自定义实体.我想用文件名查询包含哈希标记('#')的那些附件.说我附上了一些文本文件. kdk#ie.txt,Report.txt和& k!ke.txt到自定义实体. 这是我的Odata查询的结果. 错误代码:
Scenario: I have a custom entity with attachments in Dynamics CRM 2011. I want to query those attachments with file name that contains a hash tag ('#'). Say I have attached a few text documents. kdk#ie.txt, Report.txt, & k!ke.txt to the custom entity. Here are my results to my Odata query. Error Code:
///ORGANIATION/XRMServices/2011/OrganizationData.svc/AnnotationSet?$ filter = ObjectId/Id eq guid'{GUID HERE}'和IsDocument eq true和substringof('#',FileName)
//ORGANIATION/XRMServices/2011/OrganizationData.svc/AnnotationSet?$filter=ObjectId/Id eq guid'{GUID HERE}' and IsDocument eq true and substringof('#',FileName)
返回:错误的请求
因为它是unicode,所以我在string参数上尝试了以下内容. '\ u0023' 'U + 0021' 'w%u0023'
Because it is a unicode I tried the following on the string parameter. '\u0023' 'U+0021' 'w%u0023'
但是返回值为0或错误请求
But return is either 0 or Bad Request
我测试了!" & 报告"成功返回1.似乎它仅对#号无效.
I tested '!' & 'Report' it was successful return 1 respectively. It seem it only does not work for the #.
有什么想法为什么我没有得到我期望的结果?
Any ideas why I am not getting the result I expected?
真的很感激.
TIA
推荐答案
#"符号是URL中的特殊字符.必须对其进行编码,以免创建无效的URL. msdn.microsoft.com/en-us/library/aa226544 (SQL.80).aspx
"#" sign is a special character in a URL. It has to be encoded to not create an invalid URL. msdn.microsoft.com/en-us/library/aa226544(SQL.80).aspx
这篇关于Dynamics CRM:Odata查询,用于检查文件附件文件名是否包含unicode'#'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!