Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graph Explorer ErrorInvalidIdMalformed

I am using

https://developer.microsoft.com/graph/graph-explorer/

to test out some things. When I use

https://graph.microsoft.com/v1.0/me/mailFolders
https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages

I get what I expect, a list of my folders and messages in my Inbox. When change me to my email address I get the same information. Now when I try using a different mailbox I have access to and try to get the messages in "Interesting Messages" I get the ErrorInvalidIdMalformed. I assume the issue is the space in the path

https://graph.microsoft.com/v1.0/users/[email protected]/mailFolders/Interesting Messages/messages
{
"error": {
    "code": "ErrorInvalidIdMalformed",
    "message": "Id is malformed.",
    "innerError": {
        "request-id": "f47d4c3b-5681-4b83-b8f4-c2b9be591ff6",
        "date": "2019-02-07T22:39:31"
    }
}

I've tried using %20 instead of the space and I still get the error. Is there a way of having spaces in the URL or do I need to get the mailbox renamed?

TIA, Joe

like image 554
Joe Hughes Avatar asked Sep 16 '25 23:09

Joe Hughes


1 Answers

As per the docs for get messages https://learn.microsoft.com/en-us/graph/api/user-list-messages?view=graph-rest-1.0

GET /users/[email protected]/mailFolders/{id}/messages

You have to use the {id} of the mailFolder. That's why you are getting "ErrorInvalidIdMalformed" as its expecting an id.

You can get this by calling

GET /users/{id | userPrincipalName}/mailFolders

https://learn.microsoft.com/en-us/graph/api/user-list-mailfolders?view=graph-rest-1.0

like image 103
Jeremy Thake MSFT Avatar answered Sep 19 '25 19:09

Jeremy Thake MSFT