Submits an email request on behalf of the signed-in user to unsubscribe from an email distribution list.
Uses the information in the List-Unsubscribe header.
Message senders can use mailing lists in a user-friendly way by including an option for recipients to opt out.
They can do so by specifying the List-Unsubscribe header in each message following RFC-2369.
Note In particular, for the unsubscribe action to work, the sender must specify mailto: and not URL-based unsubscribe information.
Setting that header would also set the unsubscribeEnabled property of the message instance to true, and the unsubscribeData property to the header data.
If the unsubscribeEnabled property of a message is true, you can use the unsubscribe action to unsubscribe the user from similar future messages as managed by the message sender.
A successful unsubscribe action moves the message to the Deleted Items folder.
The actual exclusion of the user from future mail distribution is managed by the sender.
Submits an email request on behalf of the signed-in user to unsubscribe from an email distribution list.
Uses the information in the List-Unsubscribe header.
Message senders can use mailing lists in a user-friendly way by including an option for recipients to opt out.
They can do so by specifying the List-Unsubscribe header in each message following RFC-2369.
Note In particular, for the unsubscribe action to work, the sender must specify mailto: and not URL-based unsubscribe information.
Setting that header would also set the unsubscribeEnabled property of the message instance to true, and the unsubscribeData property to the header data.
If the unsubscribeEnabled property of a message is true, you can use the unsubscribe action to unsubscribe the user from similar future messages as managed by the message sender.
A successful unsubscribe action moves the message to the Deleted Items folder.
The actual exclusion of the user from future mail distribution is managed by the sender.
Permissions
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
Mail.Send,
Delegated (personal Microsoft account)
Mail.Send,
Application
Mail.Send,
Examples
Example 1: Code snippet
Import-Module Microsoft.Graph.Beta.Mail
# A UPN can also be used as -UserId.
Invoke-MgBetaUnsubscribeUserMessage -UserId $userId -MessageId $messageId
This example shows how to use the Invoke-MgBetaUnsubscribeUserMessage Cmdlet.
Parameters
-Break
Wait for .NET debugger to attach
Parameter properties
Type:
System.Management.Automation.SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type:
System.Management.Automation.SwitchParameter
Supports wildcards:
False
DontShow:
False
Aliases:
cf
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Headers
Optional headers that will be added to the request.
Parameter properties
Type:
System.Collections.IDictionary
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
False
-HttpPipelineAppend
SendAsync Pipeline Steps to be appended to the front of the pipeline
Credentials for a proxy server to use for the remote call
Parameter properties
Type:
System.Management.Automation.PSCredential
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-ProxyUseDefaultCredentials
Use the default credentials for the proxy
Parameter properties
Type:
System.Management.Automation.SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-ResponseHeadersVariable
Optional Response Headers Variable.
Parameter properties
Type:
System.String
Supports wildcards:
False
DontShow:
False
Aliases:
RHV
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-UserId
The unique identifier of user
Parameter properties
Type:
System.String
Supports wildcards:
False
DontShow:
False
Parameter sets
Unsubscribe
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-WhatIf
Runs the command in a mode that only reports what would happen without performing the actions.
Parameter properties
Type:
System.Management.Automation.SwitchParameter
Supports wildcards:
False
DontShow:
False
Aliases:
wi
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
To create the parameters described below, construct a hash table containing the appropriate properties.
For information on hash tables, run Get-Help about_Hash_Tables.
INPUTOBJECT <IMailIdentity>: Identity Parameter
[AttachmentId <String>]: The unique identifier of attachment
[ExtensionId <String>]: The unique identifier of extension
[InferenceClassificationOverrideId <String>]: The unique identifier of inferenceClassificationOverride
[MailFolderId <String>]: The unique identifier of mailFolder
[MailFolderId1 <String>]: The unique identifier of mailFolder
[MailFolderOperationId <String>]: The unique identifier of mailFolderOperation
[MentionId <String>]: The unique identifier of mention
[MessageId <String>]: The unique identifier of message
[MessageRuleId <String>]: The unique identifier of messageRule
[UserConfigurationId <String>]: The unique identifier of userConfiguration
[UserId <String>]: The unique identifier of user