Outlook REST API-获取登录用户的电子邮件地址 [英] Outlook REST API - Get logged in user's email address
问题描述
如何使用Outlook REST API获取登录用户的电子邮件地址?
How do I get the logged in user's email address using Outlook REST API?
我正在使用com.microsoft.services.outlook.fetchers.OutlookClient
(唯一的方法是从JWT访问令牌中提取它(请参见此处和此处)?
(最新的令牌更改此处)
Is extracting it from the JWT access token the only way (see here and here) ? (Latest changes to tokens here)
谢谢
更新: 遵循此方法:
-
获取收件箱父文件夹ID:
Get the Inbox parent folder ID:
mClient.getMe().getMailFolders().getById("Inbox").read()
inboxMailFolderResult.getParentFolderId()
使用获取的ID获取父文件夹的显示名称
Get the parent folder display name using the ID retrieved
mClient.getMe().getMailFolders().getById("ID_RETRIEVED_AAA==").read()
parentMailFolderResult.getDisplayName()
..似乎也不起作用,我只是获得信息存储区顶部作为显示名称.
..doesn't seem to work either, I just get Top of Information Store as display name.
推荐答案
用于Java的Office 365 SDK目前仅提供Outlook服务.我们还可以通过直接制作REST,通过元数据获取登录用户的电子邮件地址. 这是REST请求供您参考:
The Office 365 SDK for Java only provide the Outlook service at present. We can also get the email address of the sign-in user through the metadata via making the REST directly. Here is the REST request for your reference:
GET: https://outlook.office.com/api/v2.0/me
authorization: bearer {Token}
您将收到如下响应:
You would get the response like below:
这篇关于Outlook REST API-获取登录用户的电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!