To fetch only active folders not deleted from mailfolders

Ajeet Singh 1 Reputation point


I am using MS Graph endpoint to retrieve the folders in Outlook as mentioned below:

but I am getting even deleted folders as well. If folder is deleted and exists in Trash/Deleted Items folders or folder is deleted permanently even then we are getting such folders in the response.

Is there any way, we can differentiate deleted folders in response or we can retrieve only active folders instead of deleted folders (both exists in Trash or permanently deleted)

Thanks in advance for your help.

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

1 answer

Sort by: Most helpful
  1. Glen Scales 4,431 Reputation points

    Sounds like your using the beta endpoint rather then production eg

    rather then

    the beta does a full traversal but you shouldn't be using that in production apps as it subject to change in the future, with the production endpoint at the moment it just does a shallow traversal of whatever folder your searching so you would have to do childFolder traversal of every folder you want to retrieve subfolders for so for in the case of Deleted Items folder you just exclude that.

    0 comments No comments