Querying Fields with Name Containing Whitespace Using Odata
I Have to Make a $Filter Query on a Field That's Name Contains Whitespace. Eg, $Filter=Ticket No Eg 'Abc_123' I'm Starting to Think Its Not Possible. Can...
I have to make a $filter query on a field that's name contains whitespace. Eg, $filter=Ticket No eg 'abc_123'
I'm starting to think its not possible. Can someone help me with this please?
Thanks.
2 Answers
Thought I'd share this, I was trying to query rest services through my SharePoint hosted SharePoint 2013 app and well I found the solution. All you need to do is replace the spaces in the field name by _x0020_
OData property names cannot contain spaces. Refer to the xsd schema here. Look for the type TSimpleIdentifier in the schema. The definition looks like the following,
<xs:simpleType name="TSimpleIdentifier">
<xs:restriction base="xs:string">
<xs:maxLength value="128" />
<!-- ECMAScript identifiers not starting with a '$' -->
<xs:pattern value="[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}" />
</xs:restriction>
</xs:simpleType>