You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用MS Dynamics Web API创建邮件时sender与torecipients字段不生效求助

Fixing Sender/ToRecipients Not Showing When Creating Emails via Dynamics Web API

Hey there, I’ve run into this exact issue before! The problem is that sender and torecipients aren’t simple string fields in Dynamics CRM’s email entity—they require proper entity references or activity party collections to work correctly. Here’s what you’re missing:

Why Your Current Payload Isn’t Working

When you pass raw email strings like "sender": "test@test.com", CRM doesn’t recognize them because:

  • The sender field expects a reference to a CRM record (like a systemuser or contact), not just an email address.
  • torecipients maps to the email_activity_parties navigation property, which is a collection of activityparty records that define who’s receiving the email, along with their role (To/CC/BCC).

Correct Payload Format

Let’s break down the fix with examples:

1. Linking a Sender (CRM User/Contact)

Use @odata.bind to associate the sender with an existing CRM record:

  • For a system user: "sender@odata.bind": "/systemusers(YOUR_USER_GUID)"
  • For a contact: "sender@odata.bind": "/contacts(YOUR_CONTACT_GUID)"

2. Adding To Recipients

Use the email_activity_parties array to define each recipient. You can link existing CRM records or add external email addresses directly:

Option A: Link Existing CRM Records
{
  "subject": "Test Subject New 1234567",
  "description": "Test Description New 1234567",
  "sender@odata.bind": "/systemusers(00000000-0000-0000-0000-000000000001)",
  "email_activity_parties": [
    {
      // Link a system user as To recipient
      "partyid_systemuser@odata.bind": "/systemusers(00000000-0000-0000-0000-000000000002)",
      "participationtypemask": 2 // 2 = To recipient
    },
    {
      // Link a contact as To recipient
      "partyid_contact@odata.bind": "/contacts(00000000-0000-0000-0000-000000000003)",
      "participationtypemask": 2
    }
  ]
}
Option B: Add External Email Addresses (Not in CRM)

If you need to send to someone not in your CRM instance, use the addressused field in the activity party:

{
  "subject": "Test Subject New 1234567",
  "description": "Test Description New 1234567",
  "sender@odata.bind": "/systemusers(00000000-0000-0000-0000-000000000001)",
  "email_activity_parties": [
    {
      "addressused": "test2@test.com",
      "participationtypemask": 2
    }
  ]
}

Key Notes

  • participationtypemask values: These define the recipient role:
    • 1 = Sender
    • 2 = To
    • 3 = CC
    • 4 = BCC
  • Always use valid GUIDs for existing CRM records. You can fetch these via the Web API if you don’t have them handy.
  • For external recipients, creating a contact record first (and linking it) is better for tracking and reporting in CRM.

Once you adjust your payload to follow this structure, the sender and to recipients will show up correctly in Dynamics CRM!

内容的提问来源于stack exchange,提问作者Parth Trivedi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 07:17:03