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

  • Import Time Entries in PSA from your Bookings in D365 PSA v3

    25 April’ 2019

    Often, one of the real-life scenarios is making time entries by either remembering what you did the whole week or lookin...

    Read more
  • Managing with Multiple Legal Entity Data in Microsoft Dynamics NAV / Business Central

    25 April’ 2019

    Problem Statement: Well, my client is a Trader of Oils & Fatty Acids and has multiple legal entities to perform vari...

    Read more
  • Facing issues with Microsoft Outlook? Use Microsoft Support & Recovery Assistant

    22 April’ 2019

    Many times you find issues like one of your users are unable to set up their Office 365 Email account in Microsoft Outlo...

    Read more
  • How to insert data into reports in Business Central using a variable in Request Page

    16 April’ 2019

    Introduction: Here, I will demonstrate how a user can add data into reports by themselves from the Request Page in Busin...

    Read more
  • Non-Billable classification of task work around in PSA V3

    15 April’ 2019

    Problem Definition: As soon I upgraded my PSA version from V2 to V3, I saw that the role field got deprecated. Not only ...

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