Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pawelgradecki
Created November 28, 2018 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pawelgradecki/b126a538e1cc7e314021ff0fb2f2607d to your computer and use it in GitHub Desktop.
Save pawelgradecki/b126a538e1cc7e314021ff0fb2f2607d to your computer and use it in GitHub Desktop.
var crmClient = new CrmServiceClient(ConfigurationManager.ConnectionStrings["D365"].ConnectionString);
if (crmClient.IsReady)
{
using (var ctx = new OrganizationServiceContext(crmClient))
{
var result = ctx.CreateQuery<Contact>()
.Where(a => a.FirstName == "Jan")
.Select(a => new Contact
{
Id = a.Id,
FirstName = a.FirstName
})
.ToList();
Console.WriteLine(result.Count);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment