Breaking news from around the world
Get the Bing + MSN extension
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
2019 release wave 2 Discover the latest updates and new features to Dynamics 365 planned through March 2020
Release overview guides and videos Release Plan | View virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming 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