Dynamics CRM 多对多 查询

QueryExpression query = new QueryExpression()
{
    EntityName = "多对多字段名称",
    ColumnSet = new ColumnSet(true),
    NoLock = true,
    Criteria =
    {
        Conditions =
        {
             new ConditionExpression("A实体主字段",ConditionOperator.Equal,A实体主字段Guid)
        }
    }
};
EntityCollection ent_coll = SysService.RetrieveMultiple(query);
if (ent_coll.Entities.Count > 0)
{
    foreach(Entity ent in ent_coll.Entities)
    {
        string guid = ent.Attributes["B实体主字段"].ToString();
    }
}

 

你可能感兴趣的:(Dynamics,CRM)