How to get 'ownerid' column from CRM database of type `owner` using Web API approach?

我怕爱的太早我们不能终老 提交于 2019-12-06 12:49:56

问题


I'm using Microsoft dynamics 365 - on premises of my client. Here, I am facing an issue in accessing one of the fields - ownerid of type owner.

I am using Web API approach to access the CRM data. When I hit the query in URL, it brings all the data except ownerid column.

It's field type is: Simple

Has anyone faced the same issue with WebAPI query approach?

URL Query:

https://baseURL/moves?$select=moveid,ownerid,movenumber&$filter=movenumber%20eq%20%27236659%27

Output:

{
  "@odata.context":"https://baseURL/$metadata#moves(moveid,ownerid,movenumber)","value":[
    {
      "@odata.etag":"W/\"37655223\"","moveid":"4583b2fe-83d9-e611-80c7-369e029457bb","movenumber":"236659"
    }
  ]
}

回答1:


I think ownerid is a lookup, so you need to expand it first by using $expand query parameter, to be included in the response.

https://baseURL/moves?$expand=ownerid&$select=moveid,ownerid,movenumber&$filter=movenumber%20eq%20%27236659%27

Reference: https://docs.microsoft.com/en-us/aspnet/web-api/overview/odata-support-in-aspnet-web-api/using-select-expand-and-value



来源:https://stackoverflow.com/questions/48062099/how-to-get-ownerid-column-from-crm-database-of-type-owner-using-web-api-appr

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