According to MSDN the LinkEntities
property on QueryExpression
, "Gets a collection of the links between multiple entity types." However, when I run the OrganizationService.RetriveMultiple(QueryExpression)
I receive only one of the related entities associated with the LinkFromEntity
.
In the following example the xxx_application
has two xxx_essayresponse
entities related to it.
QueryExpression appQuery = new QueryExpression("xxx_application");
appQuery.ColumnSet = new ColumnSet(new string[] { "xxx_status", "xxx_applicant" });
appQuery.LinkEntities.Add(new LinkEntity("xxx_application", "xxx_essayresponse", "xxx_applicationid", "xxx_responsefor", JoinOperator.LeftOuter));
appQuery.LinkEntities[0].Columns.AddColumns("xxx_essayresponseid", "xxx_question");
appQuery.LinkEntities[0].EntityAlias = "essay";
EntityCollection retrivedContacts = service.RetrieveMultiple(appQuery);
After I execute the query I only receive one xxx_essayresponse on the returned Entity.
You should get an Application Entity for every Essay Response. Linked Entity Values show up as Aliased Values in the Attributes of the main Entity. So in your example, you should have had returned two Application Entities, each with different Essay Responses.