The best way to do it is via IMAP using XOAUTH. I don't know what client libraries are available for Java; its easy enough if you understand IMAP though (you get message count back when you SELECT the folder).
Things to be aware of: - All Mail does not show messages currently in the Trash - The Gmail "special" folders are locale-dependent, so you can't guarantee that it will always be called "[Gmail]/All Mail". Use the undocumented XLIST command to find out - it operates exactly like LIST, except that it returns addition flags to indicate what the folders are for - you want the folder with the "\AllMail" flag. - The "All Mail" (and all other) folders/labels can be hidden from IMAP by the user using the Advanced IMAP Settings lab (which I believe recently graduated out of Labs). There's currently no way to get around this. Cheers, Rob. On Tue, Jun 7, 2011 at 7:05 AM, Tomas Hajek <[email protected]> wrote: > Can anyone suggest a way via the java API to get a total message count in a > users mail store. That is I am migrating users e-mail and would like to get > a count of all the messages (so the "All Mail" label presumably) in a > destination users mailbox . I'd like to get a count before and after a > migration so that I can double check the count of messages uploaded. > > I'm looking now at the Email Audit API but not sure yet if I am looking in > the right place. Any one have a suggestion. > > thanks, > -Tomas > > -- > You received this message because you are subscribed to the Google Groups > "Google Apps Domain Information and Management APIs" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-apps-mgmt-apis/-/WlhpbkhfZlJtTVFK. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-apps-mgmt-apis?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google Apps Domain Information and Management APIs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-apps-mgmt-apis?hl=en.
