Get-EmailMessageAttachment
- 1 Minute to read
- Print
- DarkLight
- PDF
Get-EmailMessageAttachment
- 1 Minute to read
- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Summary
Retrieves an existing email message attachment.
Get-EmailMessageAttachment
-Id
Returns an email message attachment object.
Parameters
Parameter | Type | Required? | Notes |
---|---|---|---|
Id | Int32 | Yes | The email message attachment id. |
Examples
Get an existing email message attachment
This example retrieves a specific email message attachment and outputs it as JSON.
# Retrieve a specific email message attachment by id
$emailMessageAttachment = Get-EmailMessageAttachment -Id 10
Write-Output "Retrieved email message attachment $($emailMessageAttachment.EmailMessageAttachmentId)"
# Convert the email message attachment to output as JSON
$jsonOutput = $emailMessageAttachment | ConvertTo-Json -Depth 10
# For debug purposes, convert the email message attachment to output as JSON so we can see the available fields
Write-Output ""
Write-Output "JSON Results:"
$jsonOutput = $emailMessageAttachment | ConvertTo-Json -Depth 10
# Output the email message attachment
Write-Output $jsonOutput
Execution results:
Retrieved email message attachment 10
JSON results:
{
"EmailMessageAttachmentId": 10,
"EmailMessageId": 15,
"EmailMessage": {
// Email message fields removed
},
"FileId": "30eb90c892c74033ab478a0bf1651c79",
"File": {
// File fields removed
},
"FileName": "blue_logo_square_144pxw_144pxh.png"
}