Add-EmailMessageAttachments
  • 1 Minute to read
  • Dark
    Light
  • PDF

Add-EmailMessageAttachments

  • Dark
    Light
  • PDF

Article summary

Summary

Adds a list of attachments to an email message.

Add-EmailMessageAttachments
    -Entries

Returns a bulk import results object.

Parameters

Parameter

Type

Required?

Notes

Entries

List of Email Message Attachment objects

Yes


Examples

Add email message attachments

# Create a list of email message attachments that will be linked to an email message
# The file must already exist prior to adding them
$emailMessageAttachments = @(
  @{
    EmailMessageId = 59
    FileId = "30eb90c892c74033ab478a0bf1651c79"
  }
)

# Pass the email message attachment object to the Add-EmailMessageAttachments command to create the entries
$createdEmailMessageAttachments = Add-EmailMessageAttachments -Entries $emailMessageAttachments

# Use Write-Output to log the execution results
Write-Output "Linked $($createdEmailMessageAttachments.Inserts) attachment(s) to email message 59"

Execution results:

Linked 1 attachment(s) to email message 59