You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用Microsoft Graph API获取邮件子文件夹ID及Inbox下Test子文件夹详情

Fixing "Resource not found for the segment 'Test'" when accessing subfolders via Graph API

Got it, let's break down why your current request is failing and how to fix it: The Microsoft Graph API doesn't let you reference custom mail subfolders directly by their display name in the URL path. Segments like Inbox work because it's a well-known folder with a reserved identifier, but subfolders like Test need to be accessed using their unique folder ID or via filtered child folder queries.

Here are the two most straightforward ways to get the details of your Test subfolder:

Option 1: Fetch the Test folder ID first, then get its details

  1. Retrieve the Test folder's ID by querying Inbox's child folders and filtering by display name:

    GET https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/childFolders?$filter=displayName eq 'Test'
    

    This will return a list of folders matching the name (you'll likely get just one result). Look for the id field in the response—it'll be a long, unique string like AAMkAG...AAA=.

  2. Use the ID to get the folder details:
    Replace {test-folder-id} with the ID you found in the previous step:

    GET https://graph.microsoft.com/v1.0/me/mailFolders/{test-folder-id}
    

Option 2: Get the Test folder details in a single request

If you don't need to reuse the folder ID later, you can combine the query to get the details directly using $filter and $select (to limit the response to just the details you care about):

GET https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/childFolders?$filter=displayName eq 'Test'&$select=id,displayName,totalItemCount,unreadItemCount

This will return the full details of the Test folder in one go.

Bonus: Access nested subfolders (Test1 under Test, Test2 under Test1)

Once you have the ID of Test, you can repeat the same pattern for deeper folders:

  • To get Test1 details:
    GET https://graph.microsoft.com/v1.0/me/mailFolders/{test-folder-id}/childFolders?$filter=displayName eq 'Test1'
    
  • To get Test2 details, use the ID of Test1 in the same way.

内容的提问来源于stack exchange,提问作者Kylie

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 17:42:49