我一直堅持這一點。以下是我正在嘗試執行的操作範圍:QueryExpression Phonecall聯繫
檢索電話記錄,同時在「到」字段中引入聯繫信息。
經過大量研究,我已經將代碼歸結爲以下內容。我不太確定,如果我正在做鏈接的實體 - 但不能確定如何做一個嵌套的連接,因爲我需要以某種方式進入activitypointer - > activityparty - > contact ...我只是不知道在哪裏我「米去錯了。任何幫助,將不勝感激。
using Microsoft.Crm.Sdk.Messages.Samples;
using Microsoft.Xrm.Sdk.Query.Samples;
QueryExpression qExpression = new QueryExpression("phonecall")
{
ColumnSet = cs,
LinkEntities =
{
new LinkEntity()
{
EntityAlias = "ap",
LinkFromEntityName= "phonecall",
LinkFromAttributeName = "activityid",
LinkToEntityName = "activitypointer",
LinkToAttributeName = "activityid",
JoinOperator = JoinOperator.Inner
},
new LinkEntity()
{
EntityAlias = "app",
LinkFromEntityName= "activitypointer",
LinkFromAttributeName = "activityid",
LinkToEntityName = "activityparty",
LinkToAttributeName = "activityid",
JoinOperator = JoinOperator.Inner,
LinkCriteria = new FilterExpression
{
Conditions =
{
new ConditionExpression("ParticipationTypeMask", ConditionOperator.Equal, 2),
}
}
},
new LinkEntity()
{
EntityAlias = "con",
Columns = new ColumnSet("fullname","contactid"),
JoinOperator = JoinOperator.Inner,
LinkFromEntityName = "activityparty",
LinkFromAttributeName = "partyid",
LinkToEntityName = "contact",
LinkToAttributeName = "contactid"
}
}
};