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

Silverlight DataServiceQuery

$
0
0

I am running the following code in Silverlight against CRM and is running great:

DataServiceQuery<ServiceAppointment> query;

query = (DataServiceQuery<ServiceAppointment>)MyContext.ServiceAppointmentSet
.AddQueryOption(
"$select", "ActivityId,Subject,ScheduledStart,ScheduledEnd,ServiceId")
.AddQueryOption(
"$orderby", "ScheduledStart")
.Where<
ServiceAppointment>(a => (a.ScheduledStart.Value >= start && a.ScheduledStart <= end) && (a.StateCode.Value == 0 || a.StateCode.Value == 3));

I have a need to pull back information from the Contact entity as well. The RegardingObjectId for the ServiceAppointment contains the ContactId for the person with this appointment.

How can I do a Join/.Expand on the DataServiceQuery to pull back information from my Contacts entity? I've tried doing:
.AddQueryOption("$expand", "Contact"); - but that just fails.

Thanks!


Viewing all articles
Browse latest Browse all 82002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>