让代码更简单

Microsoft Graph开放接口学习——获取邮箱文件夹

重要:本文最后更新于2020-05-14 08:22:02,某些文章具有时效性,若有错误或已失效,请在下方留言或联系代码狗

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
}
]
}

感觉很棒!可以赞赏支持我哟~

0 打赏

评论 (0)

登录后评论
QQ咨询 邮件咨询 狗哥推荐