[英]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.