< Back

Set-MgaMailMessage

Sat Jan 18, 2020 4:43 pm

NAME Set-MgaMailMessage



SYNOPSIS

Set properties on message(s)





SYNTAX

Set-MgaMailMessage [-Message] <MessageParameter[]> [-IsRead <Boolean>] [-Subject <String>] [-Sender <String>]

[-From <String>] [-ToRecipients <String[]>] [-CCRecipients <String[]>] [-BCCRecipients <String[]>] [-ReplyTo

<String[]>] [-Body <String>] [-Categories <String[]>] [-Importance <String>] [-InferenceClassification <String>]

[-InternetMessageId <String>] [-IsDeliveryReceiptRequested <Boolean>] [-IsReadReceiptRequested <Boolean>] [-User

<String>] [-Token <AzureAccessToken>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

Set properties on message(s) in Exchange Online using the graph api.





PARAMETERS

-Message <MessageParameter[]>

Carrier object for Pipeline input. Accepts messages.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-IsRead <Boolean>

Indicates whether the message has been read.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Subject <String>

The subject of the message.

(Updatable only if isDraft = true.)



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Sender <String>

The account that is actually used to generate the message.

(Updatable only if isDraft = true, and when sending a message from a shared mailbox,

or sending a message as a delegate. In any case, the value must correspond to the actual mailbox used.)



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-From <String>

The mailbox owner and sender of the message.

Must correspond to the actual mailbox used.

(Updatable only if isDraft = true.)



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ToRecipients <String[]>

The To recipients for the message.

(Updatable only if isDraft = true.)



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-CCRecipients <String[]>

The Cc recipients for the message.

(Updatable only if isDraft = true.)



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-BCCRecipients <String[]>

The Bcc recipients for the message.

(Updatable only if isDraft = true.)



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ReplyTo <String[]>

The email addresses to use when replying.

(Updatable only if isDraft = true.)



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Body <String>

The body of the message.

(Updatable only if isDraft = true.)



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Categories <String[]>

The categories associated with the message.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Importance <String>

The importance of the message.

The possible values are: Low, Normal, High.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-InferenceClassification <String>

The classification of the message for the user, based on inferred relevance or importance, or on an explicit

override.

The possible values are: focused or other.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-InternetMessageId <String>

The message ID in the format specified by RFC2822.

(Updatable only if isDraft = true.)



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-IsDeliveryReceiptRequested <Boolean>

Indicates whether a delivery receipt is requested for the message.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-IsReadReceiptRequested <Boolean>

Indicates whether a read receipt is requested for the message.



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



-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



-PassThru [<SwitchParameter>]

Outputs the token to the console



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

If this switch is enabled, no actions are performed but informational messages will be displayed that explain

what would happen if the command were to run.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

If this switch is enabled, you will be prompted for confirmation before executing any operations that change

state.



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

MSGraph.Exchange.Mail.Message





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



PS C:\\>$mail | Set-MgaMailMessage -IsRead $false



Set messages represented by variable $mail to status "unread"

The variable $mails can be represent:

PS C:\\> $mails = Get-MgaMailMessage -Folder Inbox -ResultSize 1









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



PS C:\\>$mail | Set-MgaMailMessage -IsRead $false -categories "Red category"



Set status "unread" and category "Red category" to messages represented by variable $mail

The variable $mails can be represent:

PS C:\\> $mails = Get-MgaMailMessage -Folder Inbox -ResultSize 1









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



PS C:\\>$mail | Set-MgaMailMessage -ToRecipients "someone@something.org"



Set reciepent from draft mail represented by variable $mail

The variable $mails can be represent:

PS C:\\> $mails = Get-MgaMailMessage -Folder Drafts









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Set-MgaMailMessage -Id $mail.Id -ToRecipients "someone@something.org" -Subject "Something important"



Set reciepent from draft mail represented by variable $mail

The variable $mails can be represent:

PS C:\\> $mails = Get-MgaMailMessage -Folder Drafts









-------------------------- EXAMPLE 5 --------------------------



PS C:\\>$mail | Set-MgaMailMessage -ToRecipients $null



Clear reciepent from draft mail represented by variable $mail

The variable $mails can be represent:

PS C:\\> $mails = Get-MgaMailMessage -Folder Drafts











RELATED LINKS