I'm coding a FetchXML query to return users with disabled mailboxes in a Dynamics 2015 online CRM instance. Now I've come to a stage where the query results need to be bound to a ListView. (The project is using the Dynamics SDK 2015 libs.)
In order to do this I've tried to cast the returned result which is an EntityCollection -> to a list. But the CRMSDKTypeProxy can't be found in my code for the cast.
I was following this example's second answer in order to do the casting:
You can use the ToEntity<T> method to do the conversion to a strong typed entity like this: (In this snippet service is an object implementing the IOrganizationService interface and query is a QueryExpression object.)
// RetrieveMultiple will never return null, so this one-liner is safe to use.
var userList = service.RetrieveMultiple(query)
.Select(e => e.ToEntity<SystemUser>())
I noticed you are using the CrmServiceClient in the Microsoft.Xrm.Tooling.Connector namespace. This was introduced in Dynamics CRM 2013.