简体   繁体   English

通过C#中的字段值查找Dynamics Contact Entity

[英]Find Dynamics Contact Entity by value of field in C#

I know that I can retrieve a contact by Guid like this: 我知道我可以像这样通过Guid检索联系人:

var connection = new CrmConnection("CRM");
var service = new OrganizationService(connection);

var contact = service.Retrieve("contact", new Guid("ee07d029-e445-e511-8118-c4346bad4044"), new ColumnSet() { AllColumns = true });

...But that requires me to have the Guid of the contact. ...但是,这需要我拥有联系指南。 What if I want to find it by emailaddress1 for instance? 例如,如果我想通过emailaddress1查找该怎么办?

I'm new to Dynamics and I've tried looking at the documentation and googling it without luck. 我是Dynamics的新手,所以我尝试了一下文档仔细研究了文档。 I'm using the Online (hosted) version of Dynamics. 我正在使用Dynamics的在线(托管)版本。

Any help would be greatly appreciated. 任何帮助将不胜感激。

Something like this: 像这样:

QueryByAttribute query = new QueryByAttribute("contact");
query.ColumnSet = new ColumnSet("fullname", "emailaddress1");
query.Attributes.AddRange("emailaddress1");
query.Values.AddRange("test@test.com");
EntityCollection retrieved = service.RetrieveMultiple(query);

Sample: Retrieve multiple with the QueryByAttribute class 样本:使用QueryByAttribute类检索多个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 c#-动态CRM在线插件-使用字段值填充相关实体的属性 - c# - dynamics crm online plugin - use field value to populate attribute of related entity 在Dynamics CRM C#插件中检索查找字段的显示值 - Retrieving display value of lookup field in Dynamics CRM C# plugin 如何在特定字段值上触发动态 c# 插件 - How to fire a dynamics c# plugin on specific field value Dynamics CRM & .NET (C#) 为所有行设置字段值 - Dynamics CRM & .NET (C#) Set field value for all rows Dynamics CRM 2013 工作流 C# 从链接实体中提取字段 - Dynamics CRM 2013 Workflow C# Extract Field from Linked Entity 如何使用 C# 中的 SDK 库从 Dynamics Entity 中删除值 - How to remove value from Dynamics Entity using SDK library in C# 如何使用C#在MS Dynamics CRM中为案例的自定义字段设置/获取值 - how to set/get value to the custom field of a case in MS Dynamics CRM using C# Microsoft Dynamics CRM设置相关实体​​的字段值 - Microsoft Dynamics CRM set field value of related entity Microsoft Dynamics CRM 注释实体错误的“创建者”字段值 - Microsoft Dynamics CRM Annotation Entity wrong "Created by" Field value C#Entity Framework:使用字段值缩小结果 - C# Entity Framework: Narrow results with a field value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM