Microsoft Graph怎么获取邮箱文件夹?Microsoft Graph开放接口邮件相关学习教程到本章就完了,虽然官方还提供了其它相关接口,但其并没有多大作用,所以就不多说了。看今天的通过Microsoft Graph获取邮箱文件夹的接口内容。该接口可以直接在已登录用户的根文件夹下获取邮件文件夹集合。 返回的集合包括直接在根目录下的所有文件夹。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息。
权限类型 | 权限(从最低特权到最高特权) |
---|---|
委派(工作或学校帐户) | Mail.ReadBasic、Mail.Read、Mail.ReadWrite |
委派(个人 Microsoft 帐户) | Mail.ReadBasic、Mail.Read、Mail.ReadWrite |
应用程序 | Mail.ReadBasic.All、Mail.Read、Mail.ReadWrite |
接口详情
请求地址
https://graph.microsoft.com/v1.0/me/mailFolders
请求头
标头 | 值 |
---|---|
Authorization | Bearer {token}。必需。 |
Content-Type | application/json |
参数
支持参数控制搜索内容,具体查阅官方文档,这个搜索参数很多都是共用的,官方专门弄了个文档说明。
返回值
如果成功,此方法在响应正文中返回 200 OK
响应代码和 mailFolder 对象集合。
返回示例
{ "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('68ca8ec0-11f8-456b-a785-70d9936650d5')/mailFolders", "value": [ { "id": "AQMkADYAAAIBXQAAAA==", "displayName": "Archive", "parentFolderId": "AQMkADYAAAIBCAAAAA==", "childFolderCount": 0, "unreadItemCount": 0, "totalItemCount": 0 }, { "id": "AQMkADYAAAIBFQAAAA==", "displayName": "Conversation History", "parentFolderId": "AQMkADYAAAIBCAAAAA==", "childFolderCount": 1, "unreadItemCount": 0, "totalItemCount": 0 }, { "id": "AQMkADYAAAIBCgAAAA==", "displayName": "Deleted Items", "parentFolderId": "AQMkADYAAAIBCAAAAA==", "childFolderCount": 0, "unreadItemCount": 0, "totalItemCount": 0 }, { "id": "AQMkADYAAAIBDwAAAA==", "displayName": "Drafts", "parentFolderId": "AQMkADYAAAIBCAAAAA==", "childFolderCount": 0, "unreadItemCount": 0, "totalItemCount": 0 }, { "id": "AQMkADYAAAIBDAAAAA==", "displayName": "Inbox", "parentFolderId": "AQMkADYAAAIBCAAAAA==", "childFolderCount": 1, "unreadItemCount": 70, "totalItemCount": 71 }, { "id": "AQMkADYAAAIBGQAAAA==", "displayName": "Junk Email", "parentFolderId": "AQMkADYAAAIBCAAAAA==", "childFolderCount": 0, "unreadItemCount": 0, "totalItemCount": 0 }, { "id": "AQMkADYAAAIBCwAAAA==", "displayName": "Outbox", "parentFolderId": "AQMkADYAAAIBCAAAAA==", "childFolderCount": 0, "unreadItemCount": 0, "totalItemCount": 0 }, { "id": "AQMkADYAAAIBCQAAAA==", "displayName": "Sent Items", "parentFolderId": "AQMkADYAAAIBCAAAAA==", "childFolderCount": 0, "unreadItemCount": 0, "totalItemCount": 0 } ] }
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/241541.html