List all messages expect the archived ones

Julien Sarlat 21 Reputation points
2021-07-26T12:08:40.86+00:00

Hello,

I need to get the list of my emails and exclude all the archived ones.

I guess this is the right endpoint https://graph.microsoft.com/v1.0/me/messages

What should I add to the call?

Thanks

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

2 answers

Sort by: Most helpful
  1. Deva-MSFT 2,266 Reputation points Microsoft Employee
    2021-07-30T16:22:58.117+00:00

    You can't access the in-place archive mailbox and it's not supported in Microsoft Graph API.

    0 comments No comments

  2. Shivam Dhiman 6,056 Reputation points
    2022-03-03T17:52:49.737+00:00

    Hi @Julien Sarlat

    To get the desired results, you need Archive folder id use this below endpoint for the same

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

    179825-archiveid.png

    To get the results, you can use the below endpoint using Filter.

    https://graph.microsoft.com/v1.0/me/messages?$filter=parentFolderId ne '{ArchievefolderID}'  
    

    Result
    179827-exclude2.png

    Using the above endpoint, you will get all mails except Archive Mail.

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

    0 comments No comments

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.