Invalid Uri: The Uri scheme is too long. UriFormatException" In dynamics-CRM FetchXML

醉酒当歌 提交于 2020-04-17 19:09:55

问题


I'm trying to query a Dynamic-CRM system using FetchXML get request. The error: "Invalid Uri: The Uri scheme is too long. UriFormatException" occurs when I'm using specific attributtes\filters. For example: When trying to use filter condition with "on-or-after" operator referring dateTime with time stamp. I'm getting:

The initial query is big and working, but event when I shorten the query and use a specific attribute, the error raise. I couldn't put my finger on the problem. See my code, as example: This is not working:

<filter>
  <condition attribute="scheduledend" operator="le" value="2020-03-16T10:23:30" />
</filter>

This is working, but witout time stamp:

<filter>
  <condition attribute="scheduledend" operator="on-or-before" value="03/16/2020" />
</filter> 

Let me emphasize - The

<filter>
  <condition attribute="scheduledend" operator="le" value="2020-03-16T10:23:30" />
</filter>

might work if I remove some query attributes or filters - so this is just an example - I couldn't find a pattern for working\not working. What might be the root cause for this problem ?


回答1:


It strikes me that since the colon : is a normal part of an HTTP URI, the colons in the timestamp may be triggering the issue. According to the standard URL encoding, : encodes to %3A. Maybe give that a shot.

Another consideration is that a single quote is a legal URL character but a double quote is unsafe, so maybe switch to single quotes inside the FetchXML:

<condition attribute='scheduledend' operator='le' value='2020-03-16T10%3A23%3A30' />



来源:https://stackoverflow.com/questions/60705850/invalid-uri-the-uri-scheme-is-too-long-uriformatexception-in-dynamics-crm-fet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!