web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Send email using Web A...
Power Apps
Answered

Send email using Web API from postman

(0) ShareShare
ReportReport
Posted on by 31

I want to make an HTTP POST request using Postman to create an email record in which the "To" field is a static email address.
I intend to use the "To" as an unresolvable field, meaning that the Web API should not attempt to find a system user or a team.

The request below doesn't work

 

 

HTTP POST [Organization URI]/api/data/v9.0/emails
Content-Type: application/json; charset=utf-8
OData-MaxVersion: 4.0
OData-Version: 4.0
Accept: application/json

{
 "subject": "test",
 "to": "staticemail@domain.com"
}

 

 

Also tried this but it didn't work

 

 

{
 "subject": "test",
 "to": [ { "addressused": "staticemail@domail.com", "participationtypemask": 2}]
}

 

 

 

What is the right way to create an email using HTTP requests?

I have the same question (0)
  • v-bofeng-msft Profile Picture
    on at

    Hi @AhmadAnwar :

    Do you want to create an API to send mail through PostMan?

      Firstly,could you please check whether ’[Organization URI]/api/data/v9.0/emails’ provides the function of sending emails?

    As far as I know "[organization URI]/api/data/v9.0/emails" is the Entity Set Path of an entity named "email" in the CDS. I'm not sure if this is a coincidence.

       Secondly,I suggest you call Microsoft Graph to send emails, the related API is

    Post https://graph.microsoft.com/v1.0/me/sendMail

     In addition, you also need to get access token to use in your requests to the Graph API.

    Maybe this link will help you a lot:

    sending-email-office-365-using-postman-without-logging-in-from-browser 

      Thirdly,If you want to send emails in Canvas APP or Flow, then you can directly use the ready-made Office 365 Outlook connector.

      Finally,If you have any more questions about postman, I suggest you go to its official website for help.

     Hope this helps,

     Best Regards,

     Bof 

     

  • Ahmad Anwar Profile Picture
    31 on at

    Sorry for my vague question.

    What I want is to create an email record using the CDS Web API.
    The problem I have is setting/populating the "To" field with a static email.

    When I remove the "To" from body, the request works, but when I add it back I get this error 400 message:

    {
     "error": {
     "code": "0x0",
     "message": "An error occurred while validating input parameters: Microsoft.OData.ODataException: Does not support untyped value in non-open type.\r\n at System.Web.OData.Formatter.Deserialization.DeserializationHelpers.ApplyProperty(ODataProperty property, IEdmStructuredTypeReference resourceType, Object resource, ODataDeserializerProvider deserializerProvider, ODataDeserializerContext readContext)\r\n at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.ApplyStructuralProperties(Object resource, ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference structuredType, ODataDeserializerContext readContext)\r\n at Microsoft.Crm.Extensibility.CrmODataEntityDeserializer.ApplyStructuralProperties(Object resource, ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference structuredType, ODataDeserializerContext readContext)\r\n at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.ReadResource(ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference structuredType, ODataDeserializerContext readContext)\r\n at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)"
     }
    }

     
    I hope my question is clear now.

  • v-bofeng-msft Profile Picture
    on at

    Hi @AhmadAnwar :

     'To' is a complex type column(polymorphic lookup) in email entity, you can't update it with text or array or object as its value.Its target value is the record in these entitys (account, contact, knowledgearticle, queue, systemuser, unresolvedaddress).Please refer to this link for detailed instructions.

     I haven't tested it specifically, but maybe you can update the'To' field in this way:

    EntitySetName(GUID)

    contacts(ContactID)

     Maybe this link will help you a lot:

    https://community.dynamics.com/365/b/linn-s-power-platform-notebook/posts/power-automate-how-to-set-lookup-field-value-in-common-data-service-current-environment-flow-connector

    Best Regards,

    Bof

  • Verified answer
    Ahmad Anwar Profile Picture
    31 on at

    I figured it out.

    The right json body should like this:

     

    {
     "subject": "test",
     "email_activity_parties": [
     {"addressused":"email@test.com", "participationtypemask":2}
     ]
    }

     

    This is a blog post on how to achieve it in Power Automate.

    The last step is to find the key name, so I got the key name "email_activity_parties" by using F12 and open Dynamics 365, created an email with a static email and inspect the HTTP request made from the browser.
    Now I got the last piece of the puzzle.

    Thanks for the help.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 740 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 342 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard