简体   繁体   中英

Linq to CRM newb help required

Im trying to work with some data in the Dynamics Online of my client. They have some custom elements added by a 3rd party company who arent being at all helpful.

I need to get contacts from the standard contactSet and then grab there data from the membershipSet created by this 3rd party org.

Im really struggling with how to go about actually getting the data out of the CRM and onto the website.

from m in py3_membershipSet
join c in ContactSet on m.py3_Member.Id equals c.ContactId 
where m.statuscode.Value == 1
orderby m.py3_name
select m

This has led me to try the following on my .Net site:

var context = new XrmServiceContext();
var activeMembers = (from m in context.py3_membershipSet
join c in context.ContactSet on m.py3_Member.Id equals c.ContactId 
where m.statuscode.Value == 1
orderby m.py3_name
select m)

However, 'context' doesnt seem to contain py3_membershipSet

So Im really puzzled and stuck as to what to do next.

you need to generate the early bound classes (using crmsvcutil.exe) and specify the ServiceContextName parameter.

Assuming your context is XrmServiceContext , you need to instantiate in this way:

var context = new XrmServiceContext(service);

where service is the IOrganizationService web service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM