简体   繁体   English

如何从邮箱获取Office 365 Outlook的文件夹名称

[英]How to get office 365 outlook's folders name from a mailbox

I have authenticated for office 365 outlook using passport js 我已经使用护照js对Office 365 Outlook进行了身份验证

Now I have access token 现在我有访问令牌

So I am looking for to get all folders name with their respective folder Id. 因此,我正在寻找所有具有相应文件夹ID的文件夹名称。

I am using node-outlook library but I am not aware what APIs they have provided get only folders path and folder id. 我正在使用节点外观库,但是我不知道它们提供的API仅获得文件夹路径和文件夹ID。

Thanks 谢谢

If you only want to get the folder name and folder Id, you can use the following api call: 如果只想获取文件夹名称和文件夹ID,则可以使用以下api调用:

$http.get("https://outlook.office.com/api/v2.0/me/MailFolders/$select=Id,ChildFolderCount,DisplayName")

Since the above api, only returns main folders, I strongly suggest that you also select ChildFolderCount and add a check in the response, if ChildFolderCount>0, then get the subfolders of the parent by the following call: 由于上述api仅返回主文件夹,因此我强烈建议您还选择ChildFolderCount并在响应中添加一个检查,如果ChildFolderCount> 0,则通过以下调用获取父级的子文件夹:

$http.get("https://outlook.office.com/api/v2.0/me/MailFolders/"+parent.Id+"/childfolders?$top="+parent.ChildFolderCount)

where parent is the folder with ChildFolderCount>0. 其中parent是ChildFolderCount> 0的文件夹。

The folder resource has a DisplayName property, so that should get what you want. 文件夹资源具有DisplayName属性,因此应该可以得到所需的内容。 ( Reference ). 参考 )。

You can also explore the API over at https://oauthplay.azurewebsites.net/ . 您也可以通过https://oauthplay.azurewebsites.net/浏览API。 For example, I did a GET on https://outlook.office.com/api/v2.0/me/mailfolders , and this is an example of the result: 例如,我在https://outlook.office.com/api/v2.0/me/mailfolders上进行了GET操作,这是结果的示例:

{
  "Id": "AQMkAGZjYmY1ZTIwLWI1M2UtNGNkYS05MGQyLTQyMgBjYTliODJhNTIALgAAA6Ii1CwFSf1Ai6F6MypimPkBAGTbcv4AqpNHlH0kubDE5QwAAAIBDwAAAA==",
  "DisplayName": "Drafts",
  "ParentFolderId": "AQMkAGZjYmY1ZTIwLWI1M2UtNGNkYS05MGQyLTQyMgBjYTliODJhNTIALgAAA6Ii1CwFSf1Ai6F6MypimPkBAGTbcv4AqpNHlH0kubDE5QwAAAIBCAAAAA==",
  "ChildFolderCount": 0,
  "UnreadItemCount": 2,
  "TotalItemCount": 9
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Office 365 Outlook REST API - Office.context.mailbox.displayMessageForm 不适用于 Mac Outlook - Office 365 Outlook REST API - Office.context.mailbox.displayMessageForm not working on Mac Outlook Outlook Office 365 AddIn:如何在回复中获取消息文本和传入消息? - Outlook Office 365 AddIn: How to get the message text and the incoming message in a reply? 如何从用户输入的电子邮件地址中获取域名并将其转换为链接到邮箱? - How to get domain name from user's input of e-mail adress and turn it to link to mailbox? 如何从Office365中的JavaScript API获取重复数据 - How to get recurrence data from JavaScript API in office365 如何从Office365中的CHAR中获取ASCII - How get ASCII from CHAR in Office365 Office365 Outlook加载项-以编程方式获取租户 - Office365 outlook add in - Get tenant programmatically 如何从应用程序菜单打开 Outlook 邮箱? - How to open outlook mailbox from application menu? 如何使用 VBA 在 Office 365 Outlook 中撰写电子邮件? - How to compose email in office 365 outlook using VBA? 如何使用javascript连接到Office 365 Outlook日历 - how to connect to office 365 outlook calender using javascript Office 365 Outlook加载项自定义窗格 - Office 365 Outlook Add-In Custom Pane
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM