< Back

Get-MgaMailAttachment

Sat Jan 18, 2020 4:40 pm

NAME Get-MgaMailAttachment



SYNOPSIS

Retrieves the attachment object from a email message in Exchange Online using the graph api.





SYNTAX

Get-MgaMailAttachment [-Message] <MessageParameter[]> [[-Name] <String>] [-IncludeInlineAttachment] [-User

<String>] [-ResultSize <Int64>] [-Token <AzureAccessToken>] [<CommonParameters>]





DESCRIPTION

Retrieves the attachment object from a email message in Exchange Online using the graph api.





PARAMETERS

-Message <MessageParameter[]>

Carrier object for Pipeline input.

This can be the id of the message or a message object passed in.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-Name <String>

The name to filter by.

(Client Side filtering)



Required? false

Position? 2

Default value *

Accept pipeline input? false

Accept wildcard characters? false



-IncludeInlineAttachment [<SwitchParameter>]

This will retrieve also attachments like pictures in the html body of the mail.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-User <String>

The user-account to access. Defaults to the main user connected as.

Can be any primary email name of any user the connected token has access to.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ResultSize <Int64>

The user to execute this under. Defaults to the user the token belongs to.



Required? false

Position? named

Default value (Get-PSFConfigValue -FullName 'MSGraph.Query.ResultSize' -Fallback 100)

Accept pipeline input? false

Accept wildcard characters? false



-Token <AzureAccessToken>

The token representing an established connection to the Microsoft Graph Api.

Can be created by using New-MgaAccessToken.

Can be omitted if a connection has been registered using the -Register parameter on New-MgaAccessToken.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-MgaMailMessage | Get-MgaMailAttachment



Return all emails attachments from all mails in the inbox of the user connected to through a token.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-MgaMailMessage | Get-MgaMailAttachment -Name "MyName*"



Return all emails attachments with name MyName* from all mails in the inbox of the user connected to through a

token.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-MgaMailMessage | Get-MgaMailAttachment -IncludeInlineAttachment



Return also "inline" attachments, like pictures in html mails from all emails in the inbox of the user connected

to through a token.











RELATED LINKS