Moving a message with the Graph PowerShell SDK

Mark Wickens 71 Reputation points
2022-02-12T00:08:04.67+00:00

I want to move a message from one folder to another in the same mailbox. I can't find the command in the PowerShell SDK for this. :-/ Help?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,715 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,389 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mark Wickens 71 Reputation points
    2022-02-13T15:25:50.42+00:00

    Never mind. I found it (and the answer is actually on the page I'd linked. Oops.). I'd actually tried Move-MgUserMessage but it wasn't working because the command isn't in the Graph Mail module where I expected it to be, but in Users.Actions.

    Import-Module Microsoft.Graph.Users.Actions 
    
    $params = @{ 
    DestinationId = "deleteditems" 
    } 
    
    # A UPN can also be used as -UserId. 
    Move-MgUserMessage -UserId $userId -MessageId $messageId -BodyParameter $params
    
    0 comments No comments