GMAIL API在域中搜索用户的消息 [英] GMAIL API search user's messages in a domain

查看:89
本文介绍了GMAIL API在域中搜索用户的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在Gmail Rest API,以便按用户搜索特定域邮箱的邮件? 一个实际的例子是,通过OAuth进行身份验证后的后端服务可以在其他用户的不同域邮箱中搜索消息. 我找不到合适的Google API来执行此类研究. 有人知道解决方案吗?

Exist a Gmail Rest API in order to search by the users messages of a particular domains mailboxes? A practical example is that a backend service after authentication via OAuth can search messages in different domains mailboxes of others users. I'm not able to find the right Google API for perform this type of research. Someone know a solution for this ?

推荐答案

没有具体方法可以搜索域中的所有邮箱.您需要枚举邮箱(例如使用admin SDK目录API),然后针对每个邮箱进行搜索.显然,您的应用将需要权限来查询admin SDK,以获取域中的用户列表,然后具有每个单独邮​​箱的权限-最简单的方法是设置服务帐户,并针对该域中的这些范围将其整个域列入白名单cpanel.看: https://developers.google.com/accounts/docs/OAuth2ServiceAccount#formingclaimset

There is no concrete way to search across all mailboxes in a domain. You would need to enumerate the mailboxes (e.g. using the admin SDK directory API), then for each one perform the search there. Obviously, your app will need permissions to query admin SDK to get list of users in the domain and then permissions for each individual mailbox--the easiest way is to setup a service account and get it whitelisted for the entire domain for those scopes in domain cpanel. See: https://developers.google.com/accounts/docs/OAuth2ServiceAccount#formingclaimset

有关如何进行可与Gmail API一起使用的全域身份验证的详细信息.

For more info about how to do the auth domain-wide which can be used with the Gmail API.

这篇关于GMAIL API在域中搜索用户的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆