--- title: "Get-TaskEmailMessage" slug: "scripting-get-taskemailmessage" updated: 2025-07-17T10:30:03Z published: 2025-07-17T10:30:03Z canonical: "help.agilityblue.com/scripting-get-taskemailmessage" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.agilityblue.com/llms.txt > Use this file to discover all available pages before exploring further. # Get-TaskEmailMessage ## Summary Retrieves an existing task email message. ```powershell Get-TaskEmailMessage    -Id ``` Returns a [task email message](https://apidocs.agilityblue.com/#d3e28476-73d5-4476-a790-ddc43b61e991) 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. ```powershell # 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: ```json 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": "

This is an email created from an Agility Blue script.

This body will be replaced by a template.

",    "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 ",      "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 ",      "Contact": null,      "RelationshipTypeId": 1,      "RelationshipTypeName": "To",      "RelationshipType": null    }  ],  "Attachments": [] } ```