0
我有一个账户ID,并希望获得该账户下的联系人的收集来建立一个电子邮件列表。如何获取帐户的所有联系人并在MS Dynamics CRM中创建电子邮件列表?
//build up Email
private Email BuildEmail(ActivityParty allcontacts){.... build my emailhere}
private List<Entity> GetAllContactsFromAccountId(Guid accountId, List<Entity> toList)
{
//how can I get all the contacts here
foreach (Entity contact in Account.Contact.Entities)//????
{
Entity activityParty = new Entity("activityparty");
activityParty["partyid"] = new EntityReference("??", e.Id);
if (toList.Any(t => t.GetAttributeValue<EntityReference>("partyid").Id == e.Id)) continue;
toList.Add(activityParty);
}
return toList;
}
感谢您的回应,但它给了我转换错误。对于例如当我将它作为entitycollection在自定义工作流中返回到TargetOutput ref ...(“contact”)时,我得到并且Error不能将'entitycollection'转换为'entityreference' – transformer
我认为您可以使用Out put参数的EntityCollection类型。如[Output(“Contacts”)] [ReferenceTarget(“contact”)] public OutArgument Contacts {get;组; }。 显然你不能将entityCollection对象设置为entityReference。 –