John Balvin Arias
John Balvin Arias

Reputation: 2896

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."
    }
}

Upvotes: 0

Views: 183

Answers (1)

Ikhtesam Afrin
Ikhtesam Afrin

Reputation: 6497

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

  • Fetched the message Id from below-

enter image description here

  • Invoked POST /me/messages/{id}/move using above Id and email moved successfully to Junk Email folder.

enter image description here

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

  • If you will make GET /me/messages/{id} now using the Id generated in first step then you will get below error-

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.

Upvotes: 0

Related Questions