16 Jan’19

D365 GeneralCreating an Email activity in MS CRM through WebApi

Introduction:

This blog explains how to Create an Email activity in MS CRM through WebApi

Request:

Post URL:  <your instance url>/api/data/v9.1/emails

Header:

Content-Type: application/json
Prefer: return=representation

Body:

1. Creating Email with resolved emails (To field of email is record in MS CRM).

{
    "description" : "Email Created",  ///Email Body
    "regardingobjectid_account@odata.bind" : "/accounts(69C38067-EDB7-E811-A961-000D3A363C81)",
    "subject" : "Test Email Creation", 
    "email_activity_parties" : [
        {
            "partyid_systemuser@odata.bind" : "/systemusers(CED2E02D-188E-4AA8-B6E2-D746E9B370C1)",
            "participationtypemask" : 1  ///From Email
        },
        {
            "partyid_account@odata.bind" : "/accounts(69C38067-EDB7-E811-A961-000D3A363C81)",
            "participationtypemask" : 2  ///To Email
        }]
}

2. Creating Email with unresolved emails (To field of email is not record in MS CRM).

{
    "description" : "Email Created",
    "regardingobjectid_account@odata.bind" : "/accounts(69C38067-EDB7-E811-A961-000D3A363C81)",
    "subject" : "Test Email Creation", 
    "email_activity_parties" : [
        {
            "partyid_systemuser@odata.bind" : "/systemusers(CED2E02D-188E-4AA8-B6E2-D746E9B370C1)",
            "participationtypemask" : 1
        },
         {
           "addressused":"vvyas@cloudfronts.com",
            "participationtypemask" : 2
        }
        ]
}

3. Creating Email with multiple unresolved emails (To field of email is not record in MS CRM).

{
    "description": "Test Email",
    "regardingobjectid_account@odata.bind": "/accounts(69C38067-EDB7-E811-A961-000D3A363C81)",
    "subject": "Update Your Phone Number", 
    "email_activity_parties": [
        {
            "partyid_systemuser@odata.bind": "/systemusers(CED2E02D-188E-4AA8-B6E2-D746E9B370C1)",
            "participationtypemask": 1
        },
        {
           "addressused":" vvyas@cloudfronts.com",
            "participationtypemask": 2
        },
         {
           "addressused":" smahato @cloudfronts.com",
            "participationtypemask": 2
        }
        ]
}

Written by

Vaishali Vyas

Software Engineer

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Bulk Clear field values in D365

    15 February’ 2019

    Introduction: A very handy approach for admins and users of Dynamics 365 who want to bulk clean up field values – And...

    Read more
  • Integrating SharePoint with D365 Portal

    8 February’ 2019

    Introduction: This blog explains how we can add files from D365 Portal directly into SharePoint which was long awaited ...

    Read more
  • Run OnDemand Workflow in D365 CE UCI Apps

    31 January’ 2019

    Introduction: This blog explains the steps on how to enable OnDemand Workflow in D365 CE UCI Apps. Scenario: After clien...

    Read more
  • Create Folder Strucutre in SharePoint using MS Flows

    31 January’ 2019

    Introduction: In this blog we will see how we can create folder structure in SharePoint for Leads when the record is cr...

    Read more
  • Hide table or column in Power BI

    30 January’ 2019

    Introduction: In this article we will read on how to hide a table or column in Power BI Web Service. Scenario: I have a...

    Read more