GRAPH API for move command

Ashlesha Shirodkar 1 Reputation point
2022-07-19T20:32:14.743+00:00

I want to use the move API of Graph
i get {"error":{"code":"ErrorInvalidIdMalformed","message":"Id is malformed."}}as response. I am not sure what is wrong here

Its a POST request the URL is
https://graph.microsoft.com/v1.0/users/{userID}/messages/"+messageId+"/move"

Processed is a folder created in the Inbox.
{\"destinationId\":\"Processed\"}";

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,005 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sheena-MSFT 1,731 Reputation points
    2022-07-20T08:16:32.517+00:00

    Hi @Ashlesha Shirodkar ,

    According to this documentation, we have to pass the folder id as the destinationid in the request body.

    Or a well known folder name refer this to see well known folder names.

    Here processed is a custom folder we have to pass the folder id.

    I am able to repro your issue PFB screenshot
    222605-move1.png

    To get folder id use the below API

    GET /me/mailFolders  
    GET /users/{id | userPrincipalName}/mailFolders  
    

    222642-move3.png

    In the response you will get the folder id.

    To move messages to that folder use the below API

    POST /me/messages/{id}/move  
    POST /users/{id | userPrincipalName}/messages/{id}/move  
    POST /me/mailFolders/{id}/messages/{id}/move  
    POST /users/{id | userPrincipalName}/mailFolders/{id}/messages/{id}/move  
      
      
    Request body   
    {  
        "destinationId": "AAMkADMwZWM4YjM1LTc2YWMtNDUzNi1iZWM3LTQyMTcyYmYyYjY1YgAuAAAAAABJ-2SvtvxuRJrCOoXKw95uAQC82qtrbRdzT5cepwnhZ_EVAACXeWY3AAA="  
    }  
    

    222643-move2.png

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.