Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

How to create an OrganizationService instance from CrmServiceClient?

$
0
0

I'm using the CrmServiceClient from the XRM tooling library in order to run queries on a CRM instance.

Does anyone know how I can cast the CrmServiceClient to an OrganizationService instance?

I need to create this instance in order to access the OrganizationService.Retrieve():
In order to do the following, where sourceService is an instance of OrganizationService -

sourceService.Retrieve(entityName, queueId, attributes);



At the moment I can run a query by casting the CrmServiceClient to an OrganizationServiceContext instance like this -

CrmServiceClient svcClient = Ctrl.CrmConnectionMgr.CrmSvc;

         
using (OrganizationServiceContext sourceContext = new OrganizationServiceContext(svcClient.OrganizationServiceProxy))
              

Q0 = (from q in sourceContext.CreateQuery("queue")
where q.GetAttributeValue<OptionSetValue>("emailrouteraccessapproval").Value == 2 ||
q.GetAttributeValue<OptionSetValue>("emailrouteraccessapproval").Value == 3

select q).ToList();








Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images