I need to make a request from my application in MCCRM and find the data. for the purpose of learning and testing, I made a console application, at the moment it can only connect to CRM, but I don’t put my mind on what to do next. I did not find any clear examples and recommendations by Google (find = the value for which you want to search. I will be grateful for the help in explaining and prompting for working with MSCRM SDK

using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Crm.Sdk.Messages; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Client; using System.ServiceModel.Description; using Microsoft.Crm.Sdk.Query; namespace ConsoleApp1 { class Program { static void Main(string[] args) { try { static IOrganizationService _service; ClientCredentials credentials = new ClientCredentials(); credentials.UserName.UserName = "Example"; credentials.UserName.Password = "example"; Uri serviceUri = new Uri("https://example.csv"); OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, null, credentials, null); proxy.EnableProxyTypes(); _service = proxy; } catch (Exception ex) { Console.WriteLine("Error while connecting to CRM " + ex.Message); Thread.Sleep(100); } Guid userid = ((WhoAmIResponse)_service.Execute(new WhoAmIRequest())).UserId; if (userid != Guid.Empty) { Console.WriteLine("Connection Established Successfully"); Thread.Sleep(100); } string Find = "1320002325"; } }} 

I decided to supplement this post with the information that I did.
it was necessary to form a fetch request, either write with pens, or create a request through an advanced search in CRM

  string fetch = @" <fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'> <entity name='account'> <attribute name='name' /> <attribute name='accountid' /> <attribute name='rgc_allow_auto_update' /> <attribute name='accountnumber' /> <attribute name='statecode' /> <order attribute='name' descending='false' /> <filter type='and'> <condition attribute='accountnumber' operator='eq' value='1320002325' /> </filter> </entity> </fetch>"; 

and the actual request itself

 EntityCollection result = _service.RetrieveMultiple(new FetchExpression(fetch)); 

With this method, it is possible to pull up to 5000 entries once.

    0