Personalized Community is here!
Quickly customize your community to find the content you seek.
Check out the latest Sales updates!Learn about the key capabilities and features of Dynamics 365 Sales and experience some of the new features.
Download overview guide | Watch Sales video
2021 Release Wave 2Discover the latest updates and new features releasing from October 2021 through March 2022.
2021 release wave 2 plan
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
How can I get a list of contacts in Dyanmics 365 using .NET C#?
You can use FetchXml or QueryExpression to retrieve the data. We prefer FetchXml, and it is easy to construct using Advanced Find in D365.
// Retrieve all contacts
string fetch2 = @"
<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<attribute name='fullname' />
<attribute name='telephone1' />
<attribute name='contactid' />
<order attribute='fullname' descending='false' />
EntityCollection result = _crmServiceClient.RetrieveMultiple(new FetchExpression(fetch2));
foreach (var c in result.Entities)
Please find the blog, on how to create a .Net Application and run the sample code inside _crmServiceClient.IsReady block.
Please mark this answer as verified, if it helped you to solve your issue.
What is _crmServiceClient ?
How can I not use XML?
You can try the following links to extract multiple records in dynamics 365
Please mark this answer as verified, if you found it useful.
If you are using simple console application to extract contacts from CRM first establish connection with CRM
ClientCredentials credentials = new ClientCredentials();
credentials.UserName.UserName = "UserName";
credentials.UserName.Password = "Password";
Uri serviceUri = new Uri("url/.../Organization.svc);
OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, null, credentials, null);
service = (IOrganizationService)proxy;
Now use service to fetch Contacts either by Fetch XML or query Expression as mentioned in earlier posts.
Hi, if you mean list of entity, this method return a list of Entity where each entity is a contact.
You can also filter query expression to take only contact that repsponds to your needs.This method returns all contacts.private List<Entity> GetContacts(IOrganizationService service)
var query = new QueryExpression("contact");
query.ColumnSet = new ColumnSet(true); // true : return all columns
EntityCollection ec = service.RetrieveMultiple(query).Entities;
var contacts = new List<Entity>(ec);
Business Applications communities