CRM Dynamics contains native entities (contact, account, opportunity, appointment …).
The CRM SDK API already contains specific classes for these native entities.
It is possible to create customized entities. To use them in programs, i found that there
are two options for that : either use crm webservice or use the CRM SDK API. With the latter option, you have to use Dynamic entity to access your custom entities.
I used the first option (CRM WebService).
In order to do that, you need to download the WSDL file from the CRM server
and update the references in your C# project as follows :
A) Download WSDL files
1. Log on to CRM then go to Settings -> Customization – > Download Web Service Description Files
2. This will display two options CrmService.asmx and MetadataService.asmx.
3. Click on MetadataService.asmx first and it will open up in new window as XML.
In this new window click on File –> Save as and save it to particular location as <
The WSDL file contains the list of all entities, customized and natives, along with their respective attributes and the types of these attributes (Lookup, String, CrmDateTime, Picklist, CrmBoolean, CrmMoney, CrmNumber …)
4. Follow similar step for CrmService.asmx
B) Add them as Web References in your visual studio project as follows :
1. Click on Add Web Reference
2. Put the file path in the URL (C:\web services references\CrmService.xml) and then put the web reference name and click ok.
Call it WebReferenceCRMService for instance.
3. Add the other Web Reference for MetadataService.xml
4. Add the namespace in your program :
Then in the C# class, you use it as follows :
myCustomEntity customEntity = new myCustomEntity(); customEntity.myAttrib1 = ...