Set Values of all Data Types using Web API in Dynamics CRM Through C#

By | April 13, 2016

Introduction:

With the release of Microsoft Dynamics CRM 2016, Web API which was introduced offers a development experience across many devices, languages and platforms.

In this blog we will take a look at how to set the all the datatypes in the CRM using C# through a windows application and using Web API.

You may refer this blog for connecting the CRM through the Web API.

Sample code to create an Account Entity Record with all Data Types:

//Initialize the WebAPIHandler class on Load of the Form as seen below:

Sample code to create an Activity & set Activity Party:

The __webAPIHandler.CreateRecord() method is in WebApiHandler class.

It is as below:

For the methods GetHttpClientObject(),GetHttpRequestMessage you may refer this blog.

To get the JObject, JArray i.e Json Objects you need to add reference to the Newtonsoft.Json.You may add it through Nuget using this command Install-Package Newtonsoft.Json.

Conclusion:

Hope the above code helps to set all the data types in Dynamics CRM.

Now export your Dynamics CRM Reports to word, excel or pdf in just 1 click with Click2Export

Leave a Reply