Has anybody used the REST-API for sending emails for the work items

Mubin Girach 0 Reputation points
2024-06-14T11:39:22.7733333+00:00

I came across a Microsoft Document https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/send-mail/send-mail?view=azure-devops-rest-7.1#mailmessage which is for sending emails related to the work items via Rest API but it seems to be incomplete as unlike other documents it doesn't have the sample request.

Making it slightly tricky to craft the request as it throws an error saying

Value cannot be null.\r\nParameter name: clientRecipients

The request I tried was as follows

{
  "fields": [],
  "ids": [],
  "message": {
    "body": "Your mail content in HTML format",
    "subject": "Your mail subject",
    "cc": {
      "emailAddresses": ["cc@example.com"]
    },
    "to": {
      "emailAddresses": ["recipient1@example.com", "recipient2@example.com"]
    }
  },
  "persistenceId": "your_persistence_id",
  "projectId": "your_project_id",
  "sortFields": ["field1", "field2"],
  "tempQueryId": "your_temp_query_id",
  "wiql": "your_wiql_query"
}
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,764 questions
{count} votes