简体   繁体   English

Microsoft Graph 如何为不同的用户请求电子邮件?

[英]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.

相关问题 如何在MVC应用程序中使用Microsoft Graph访问其他用户的资源(特别是电子邮件)? - How can I access another user's resources (specifically emails) using Microsoft Graph in an MVC app? 使用Microsoft Graph无需任何用户交互即可获取电子邮件 - Using Microsoft Graph to fetch emails without any user interaction 电子邮件未通过 Microsoft Graph - Emails not getting through Microsoft Graph 如何在UWP应用中使用Microsoft Graph自动获取新电子邮件 - How to get new emails automatically using Microsoft Graph in a UWP app Microsoft Graph CSharp SDK和筛选-如何构造在两个不同日期进行筛选的请求? - Microsoft Graph CSharp SDK and Filtering - How to construct a request to filter on two different dates? Microsoft.Graph - 如何从具有不同用户名的共享邮箱发送? - Microsoft.Graph - How to send from shared email box with different user names? 错误 400 - 使用 Microsoft Graph 错误请求创建用户 - Error 400 - Bad Request an Creating user with Microsoft Graph 使用 HttpClient 向 Microsoft Graph 请求用户列表时出现未授权问题 - UnAuthorized issue when request user list to Microsoft Graph by using HttpClient C#:如何阅读微软办公邮件。 不同的方法 - C#: How to read Microsoft office emails. Different approaches 我如何从最近一小时通过Microsoft Graph获取电子邮件? - How can I get Emails through Microsoft Graph from the last hour?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM