Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Commit

Permalink
Update-Message's parameters now can be used independently
Browse files Browse the repository at this point in the history
The parameter sets for Update-Message were causing PowerShell to forbid
the usage of -Read, -Unread, -Star and -Unstar separately
  • Loading branch information
nblagoev committed Jul 12, 2014
1 parent 281e32c commit d96bedd
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Gmail.ps.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -502,20 +502,12 @@ function Update-Message {
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[AE.Net.Mail.MailMessage]$Message,

[Parameter(ParameterSetName = "Seen_Unflagged")]
[Parameter(ParameterSetName = "Seen_Flagged")]
[switch]$Read,

[Parameter(ParameterSetName = "Unseen_Unflagged")]
[Parameter(ParameterSetName = "Unseen_Flagged")]
[switch]$Unread,

[Parameter(ParameterSetName = "Unseen_Flagged")]
[Parameter(ParameterSetName = "Seen_Flagged")]
[switch]$Star,

[Parameter(ParameterSetName = "Unseen_Unflagged")]
[Parameter(ParameterSetName = "Seen_Unflagged")]
[switch]$Unstar,

[switch]$Archive,
Expand All @@ -524,6 +516,15 @@ function Update-Message {
)

process {

if ($Read -and $Unread) {
Write-Error "The -Read and -Unread parameters cannot be used together."
}

if ($Star -and $Unstar) {
Write-Error "The -Star and -Unstar parameters cannot be used together."
}

if ($Archive) {
$Session.MoveMessage($Message.Uid, "[Gmail]/All Mail")
}
Expand Down

0 comments on commit d96bedd

Please sign in to comment.