Search code examples
gmailgoogle-email-settings-api

How to get mails of delegated accounts


Being authenticated as user1, i'd like to retrieve mails of all the users who have delegated access to user1.

So i have two problems :

  1. Retrieve all the accounts that have delegated access
  2. Retrieve the mails

The emails-settings-API gives acccess to delegates, not delegators.

Is there a way to do that progamatically.

Feel free to ask for more information


Solution

  • To find out who has given you delegated access to their account, you would need to perform the retrieve delegates API call: https://developers.google.com/google-apps/email-settings/#retrieving_all_gmail_delegates

    for all users in your Google Apps instance.

    Programmatic access to a user's gmail mailbox is provided by IMAP OAuth logins: https://developers.google.com/google-apps/gmail/oauth_overview

    However, there is currently no way for a delegate to access a delegators mailbox via IMAP so I'm afraid you're out of luck.

    If you are an administrator, you can use IMAP OAuth login along with service accounts: https://developers.google.com/accounts/docs/OAuth2ServiceAccount

    this will give you programmatic access to all users in your Google Apps instance.

    Jay