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!