Dynamics crm查询表达式“联系人”不包含属性

问题描述 投票:0回答:1

我在工作流程中使用此处显示的代码,但是当我运行它时,始终出现以下错误:

''Contact'实体不包含Name ='']的属性>

List<Guid> PPLyonIds = new List<Guid>();

QueryExpression qe = new QueryExpression(Personne_physique.EntityLogicalName);
qe.ColumnSet = new ColumnSet("contactid");
qe.Criteria.AddCondition("fullname", ConditionOperator.In, nomsprenomscpdevtry.Cast<Object>().ToArray());

EntityCollection res = organisationProxy.RetrieveMultiple(qe);

IEnumerable<Personne_physique> personnes = res.Entities.Select(x => x.ToEntity<Personne_physique>());
PPLyonIds = personnes.Select(x => x.Id).ToList<Guid>();

logger.Debug(" nombre des ids" + PPLyonIds.Count);

List<Guid> respIds = new List<Guid>();

QueryExpression qee = new QueryExpression(Reponse_de_campagne.EntityLogicalName);
qee.ColumnSet = new ColumnSet("activityid");

LinkEntity personnePhyLink = qee.AddLink("contact", "contactid", "new_personnephysiquecible");

FilterExpression filter = personnePhyLink.LinkCriteria.AddFilter(LogicalOperator.And);
filter.AddCondition("contactid", ConditionOperator.In, PPLyonIds.Cast<Object>().ToArray());
filter.AddCondition("activityid", ConditionOperator.Equal, Guid.Parse("4B90DEA4-680C-EA11-80FE-005056B14DD3"));

qee.Criteria.AddFilter(filter);
qee.LinkEntities.Add(personnePhyLink);

EntityCollection rese = organisationProxy.RetrieveMultiple(qee);
IEnumerable<Reponse_de_campagne> reponses = rese.Entities.Select(x => x.ToEntity<Reponse_de_campagne>());

respIds = reponses.Select(y => y.Id).ToList();

logger.Debug(" nombre des ids" + respIds.Count);

并且在我的FetchXML中,这是代码

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="campaignresponse">
    <attribute name="subject" />
    <attribute name="regardingobjectid" />
    <attribute name="customer" />
    <attribute name="new_activitedecampagneparente" />
    <attribute name="new_retoursouscription" />
    <attribute name="new_concretisationtousproduits" />
    <attribute name="new_concretisation" />
    <order attribute="subject" descending="false" />
    <link-entity name="contact" from="contactid" to="new_personnephysiquecible" alias="ab" />
  </entity>
</fetch>
````
Cordially

我在工作流程中使用此处显示的代码,但是在运行它时,我不断收到以下错误:'Contact'实体不包含名称为=“ List PPLyonIds = new List&...的属性] >

c# .net linq dynamics-crm-2011
1个回答
0
投票
我相信AddLink应该是这样的:(“实体”,外键,主键)。就像在FetchXML中一样
© www.soinside.com 2019 - 2024. All rights reserved.