I want to execute the flow fetchXml by webapi,
<fetch version='1.0' output-format='xml-platform' mapping='logical' aggregate='true'>
<entity name = 'new_mob_notification' >
<attribute name='new_name' alias='colcount' aggregate='countcolumn'/>
<filter type ='and'>
<condition attribute = 'new_readstatus' operator= 'eq' value = '1' />
<condition attribute = 'statecode' operator= 'eq' value = '0' />
<condition attribute = 'new_receiver' operator= 'eq' value = '67781f72-450c-e611-80bc-000c292d3ec1' />
</filter>
</entity>
</fetch>
when executed by HTTP GET with QueryString , it run successfully.
but when I run in $batch , crm throw the follow exception:
{"Message":"'select' and 'expand' cannot be both null or empty.","ExceptionMessage":"'select' and 'expand' cannot be both null or empty.","ExceptionType":"System.ArgumentException","StackTrace":" 在 System.Web.OData.Query.SelectExpandQueryOption..ctor(String select, String expand, ODataQueryContext context, ODataQueryOptionParser queryOptionParser)\r\n 在 Microsoft.Crm.Extensibility.OData.CrmODataEntityTypeSerializer.CreateSelectExpandNode(EntityInstanceContext entityInstanceContext)\r\n 在 System.Web.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteEntry(Object graph, ODataWriter writer, ODataSerializerContext writeContext, IEdmTypeReference expectedType)\r\n 在 System.Web.OData.Formatter.Serialization.ODataFeedSerializer.WriteFeed(IEnumerable enumerable, IEdmTypeReference feedType, ODataWriter writer, ODataSerializerContext writeContext)\r\n 在 System.Web.OData.Formatter.ODataMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content, HttpContentHeaders contentHeaders)\r\n 在 System.Web.OData.Formatter.ODataMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\r\n--- 引发异常的上一位置中堆栈跟踪的末尾 ---\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n 在 System.Web.OData.Batch.ODataBatchResponseItem.<WriteMessageAsync>d__0.MoveNext()\r\n--- 引发异常的上一位置中堆栈跟踪的末尾 ---\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n 在 System.Web.OData.Batch.ODataBatchContent.<SerializeToStreamAsync>d__0.MoveNext()\r\n--- 引发异常的上一位置中堆栈跟踪的末尾 ---\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n 在 System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__1b.MoveNext()","ErrorCode":500}
the full http request is :
------------------------------------------------------------------------------------------------------------
POST crm2.recloud.cc/.../v8.2$batch HTTP/1.1
Authorization: Bearer *********
Accept: application/json
OData-MaxVersion: 4.0
OData-Version: 4.0
Prefer: odata.include-annotations="*"
MSCRMCallerID: 67781f72-450c-e611-80bc-000c292d3ec1
Content-Type: multipart/mixed; boundary="batch__boundary_cd52b5621bd64456ad73a33add6c0021"
Host: crm2.recloud.cc:4431
Content-Length: 918
Expect: 100-continue
Accept-Encoding: gzip, deflate
--batch__boundary_cd52b5621bd64456ad73a33add6c0021
Content-Type: application/http
Content-Transfer-Encoding: binary
GET /org1/api/data/v8.2/new_mob_notifications?fetchXml=%3Cfetch+version%3D%271.0%27+output-format%3D%27xml-platform%27+mapping%3D%27logical%27+aggregate%3D%27true%27%3E%3Centity+name+%3D+%27new_mob_notification%27+%3E%3Cattribute+name%3D%27new_name%27+alias%3D%27colcount%27+aggregate%3D%27countcolumn%27%2F%3E%3Cfilter+type+%3D%27and%27%3E%3Ccondition+attribute+%3D+%27new_readstatus%27+operator%3D+%27eq%27+value+%3D+%271%27+%2F%3E%3Ccondition+attribute+%3D+%27statecode%27+operator%3D+%27eq%27+value+%3D+%270%27+%2F%3E%3Ccondition+attribute+%3D+%27new_receiver%27+operator%3D+%27eq%27+value+%3D+%2767781f72-450c-e611-80bc-000c292d3ec1%27+%2F%3E%3C%2Ffilter%3E%3C%2Fentity%3E%3C%2Ffetch%3E HTTP/1.1
Host: crm2.recloud.cc:4431
--batch__boundary_cd52b5621bd64456ad73a33add6c0021--
------------------------------------------------------------------------------------------------------------
my crm version : dynamics 365, v8.2
??
*This post is locked for comments