[英]Microsoft Graph how to request emails for a different user?
I understand how this call works (to get my own emails):我了解此电话的工作原理(以获取我自己的电子邮件):
graphClient.Me.MailFolders.Inbox.Messages.Request().GetAsync();
How would I use a similar call do get another user's emails?我将如何使用类似的电话来获取其他用户的电子邮件? Would it be something like this?:会是这样吗?:
graphClient.Users["userid"].MailFolders.Inbox.Messages.Request().Top(25).GetAsync();
When I execute this, I get this error: "Error in /Home/GetEmails: Caller needs to authenticate."当我执行此操作时,出现此错误:“/Home/GetEmails 中的错误:呼叫者需要进行身份验证。”
You can only do this if you request for an App Only Token using App Only permissions for access to the Microsoft Graph.仅当您使用 App Only 权限来请求 App Only Token 以访问 Microsoft Graph 时,才能执行此操作。
Read here to learn about the different Graph Permissions for the Mail Endpoint .阅读此处了解邮件端点的不同图形权限。
I think this only works for AAD accounts, and you must be a Tenant Administrator to consent to these kinds of permissions.我认为这仅适用于 AAD 帐户,您必须是租户管理员才能同意这些权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.