Get-TaskEmailMessage

Prev Next

Summary

Retrieves an existing task email message.

Get-TaskEmailMessage
    -Id

Returns a task email message object.

Parameters

Parameter

Type

Required?

Notes

Id

Int32

Yes

The task email message id.

Examples

Get an existing task email message

This example retrieves a specific task email message and outputs it as JSON.

# Retrieve a specific task email message by id
$entity = Get-TaskEmailMessage -Id 79

Write-Output "Retrieved email message $($entity.TaskEmailMessageId) (Subject: $($entity.EmailMessage.Subject))"

# For debug purposes, convert the task email message to output as JSON so we can see the available fields
Write-Output ""
Write-Output "JSON Results:"

$jsonOutput = $entity | ConvertTo-Json -Depth 10

# Output the task
Write-Output $jsonOutput

Execution results:

Retrieved email message 79 (Subject: Email created from an Agility Blue script)

JSON Results:
{
  "TaskEmailMessageId": 79,
  "TaskId": 1100,
  "TaskName": "Relativity production request",
  "Task": {
    // Task data removed for readability
  },
  "EmailMessageId": 81,
  "EmailMessage": {
    "EmailMessageId": 81,
    "ExternalMessageId": "xB3mRC-AQQuArb11yZvhIr",
    "Direction": "Outbound",
    "Status": "Sent",
    "To": "aarmari@agilityblue.com; mmiller@agilityblue.com",
    "Cc": null,
    "Bcc": null,
    "FromAddress": "notify@sadiebluesoftware.com",
    "FromName": "Agility Service",
    "Subject": "Email created from an Agility Blue script",
    "Date": "2025-04-15T11:52:18.556101-05:00",
    "Body": "<p>This is an email created from an Agility Blue script.</p><p>This body will be replaced by a template.</p>",
    "HasAttachments": false,
    "ThreadId": null,
    "Size": 149,
    "IsDeleted": false,
    "CreatedOn": "2025-04-15T16:52:18.6041331+00:00",
    "CreatedBy": null,
    "CreatedByFullName": "Max Miller",
    "CreatedById": "510e109b-6ff5-4442-9670-cd5e3cd82a7a",
    "SentById": "510e109b-6ff5-4442-9670-cd5e3cd82a7a",
    "SentOn": "2025-04-15T16:53:00.0683313+00:00",
    "SentBy": null,
    "SentByFullName": "Max Miller",
    "LastUpdatedById": "510e109b-6ff5-4442-9670-cd5e3cd82a7a",
    "LastUpdatedOn": "2025-04-15T16:53:00.083151+00:00",
    "LastUpdatedBy": null,
    "LastUpdatedByFullName": "Max Miller",
    "AssociatedContacts": [],
    "Attachments": [],
    "History": []
  },
  "AssociatedContacts": [
    {
      "EmailMessageContactId": 146,
      "EmailMessageId": 81,
      "EmailMessage": null,
      "ContactId": 1,
      "ContactFullName": "Angela Amari",
      "ContactEmailAddress": "aamari@agilityblue.com",
      "ContactNameAndEmailAddress": "Angela Amari <aamari@agilityblue.com>",
      "Contact": null,
      "RelationshipTypeId": 1,
      "RelationshipTypeName": "To",
      "RelationshipType": null
    },
    {
      "EmailMessageContactId": 147,
      "EmailMessageId": 81,
      "EmailMessage": null,
      "ContactId": 85,
      "ContactFullName": "Max Miller",
      "ContactEmailAddress": "mmiller@agilityblue.com",
      "ContactNameAndEmailAddress": "Max Miller <mmiller@agilityblue.com>",
      "Contact": null,
      "RelationshipTypeId": 1,
      "RelationshipTypeName": "To",
      "RelationshipType": null
    }
  ],
  "Attachments": []
}