Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odata client generate invalid character on URL #896

Open
leokc-ng opened this issue Feb 22, 2023 · 0 comments
Open

odata client generate invalid character on URL #896

leokc-ng opened this issue Feb 22, 2023 · 0 comments

Comments

@leokc-ng
Copy link

Hi, I am having issue with the odataclient generate additional single quote on part of my URl when I try to generate URL similar to the following example

https://testwebsite.com/api/data/v9.2/EntityDefinitions(LogicalName='account')?$select=DisplayName

I constructed the query as follow
string filterStr = $"LogicalName='account'"
var oDataQuery = client.For("EntityDefinitions").Key(filterStr).Select("DisplayName");
var result = (await oDataQuery.FindEntryAsync());

I am getting WebRequestException where the resulting URL is

https://testwebsite.com/api/data/v9.2/EntityDefinitions(%27LogicalName%3D%27%27aadusers%27%27%27)?$select=DisplayName

So basically I get an additional ' wrap around my key

I trace this error down to CommandFormatter ConvertValueToUriLiteral(object value, bool escapeDataString) method where ODataUriUtils.ConvertToUriLiteral method create the additional single quote.

Please point me to the right direction if this is a bug or how I should addressed this issue.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant