问题
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 ?
回答1:
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
For more info about how to do the auth domain-wide which can be used with the Gmail API.
来源:https://stackoverflow.com/questions/26057832/gmail-api-search-users-messages-in-a-domain