16 Jan’19

D365 General

Creating 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

  • How to Run Reports when report processing takes long to cause Session Time-out

    12 July’ 2019

    Introduction: I’ve observed that when NAV is used for a very long time, the report which needs heavy processing ta...

    Read more
  • First Canvas Power App: Learn Few Easy and Important Commands

    11 July’ 2019

    As my thoughts build to initiate writing this blog, similar was the feeling when I first thought about exploring Power A...

    Read more
  • Tips to Solve your Infinite Loop Issue

    3 July’ 2019

    While using fetch xml to retrieve records more than 5000 records and if you have multiple entities involve in it. There ...

    Read more
  • Deploy Dynamics 365 Operations Environment using Lifecycle Services – Part 2

    2 July’ 2019

    In this article, we will take look at the post configuration setting for Finance and Operations environment.You can lo...

    Read more
  • Shift/Statement posting error in Microsoft Dynamics 365 For Retail

    1 July’ 2019

    In this blog I am going to  demonstrate how to deal with errors generated during statement posting. At times while you ...

    Read more
  • We respect your privacy.
  • This field is for validation purposes and should be left unchanged.