Dynamics CRM: Odata query that checks if the file attachment file name contains the unicode '#'
Asked Answered
A

1

1

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}' and IsDocument eq true and substringof('#',FileName)

Return: Bad Request

Because it is a unicode I tried the following on the string parameter. '\u0023' 'U+0021' 'w%u0023'

But return is either 0 or Bad Request

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?

Really appreciate it.

TIA

Audrey answered 15/10, 2015 at 1:58 Comment(1)
Oh my. msdn.microsoft.com/en-us/library/aa226544(SQL.80).aspx This answered my question. :)Audrey
D
1

"#" 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

Diondione answered 19/10, 2015 at 17:28 Comment(1)
I realize you already figured this out, but for SO Completeness, it should not be an unanswered question, since you already have the answer.Diondione

© 2022 - 2024 — McMap. All rights reserved.