
Hi Experts,
I am using MS CRM onpremise 8.2.
I have a requirement to create an email and add it to the existing Queue in CRM using web API. Basically, the 3rd party system is calling the CRM API to create the email and add it to the specific queue. Can you please share the C# code for it as we don't use the Azure.
Thanks
Amit
Hello Amit,
Hope all is well.
I would suggest starting by playing around with the publicly available C# samples for the WebAPI. Even though you are using Dynamics CRM On-Prem v8.2 most of them are still applicable with the difference being the Connection String and Auth method.
Samples:
- docs.microsoft.com/.../web-api-samples-csharp
- docs.microsoft.com/.../basic-operations-csharp
Connections Strings:
docs.microsoft.com/.../use-connection-strings-xrm-tooling-connect
To create an email (or any other entity of sorts) you will need to perform a POST request againt the /api/data/v8.2/emails by passing the required parameters to fill in the corresponding attributes.
After creating the email you will need to get the GUID for both the Email and the queue you want to send it to. With those two values you can either use the AddToQueue WebAPI action (might be easier) or manually creating a QueueItem.
AddToQueue Action:
docs.microsoft.com/.../addtoqueue (Source Queue wouldn't be necessary here).
Example for the AddToQueue body:
{"entity":{"@odata.type":"Microsoft.Dynamics.CRM.queue","queueid":"<queueguid>"},"Target":{"@odata.type":"Microsoft.Dynamics.CRM.email","activityid":"<emailguid>"}}
Hope this helps :)