azureoutlookmicrosoft-graph-apimicrosoft-graph-mail

move folder to another one microsoft API getting this error: ErrorItemNotFound


I created an app with permissions:

enter image description here

So then I get the permissions from the user and get the final token. I'm able to get the emails with GET /me/messages/ I'm able to get the folders names and ids with with GET /me/mailFolders/ But 'm not able to move the email to another folder, I'm doing this:

POST /me/messages/{msg id}/move
Content-type: application/json

{
  "destinationId": "junkemail"
}

I tried to send it to other folders, even with folders created manually,I've used the folder name, folder id, but still doesn't work, I always get the same error:

{
    "error": {
        "code": "ErrorItemNotFound",
        "message": "The specified object was not found in the store., The process failed to get the correct properties."
    }
}

Solution

  • I am also having Mail.ReadWrite, offline_access, User.Read permissions. In order to move email, I did the following steps-

    enter image description here

    enter image description here

    Please note, Id will get changed once the email is moved to any other folder.

    enter image description here

    So, I would suggest you to make GET /me/messages/{id} call to check whether the email Id is exist before making POST /me/messages/{id}/move call.