0

I use the .Net API for managing my organization's users within Google Apps. Within the directory API you can "RetrieveUser". This returns a User object that has a date property of "LastLoginTime".

Google used to separate out their Last Login Time for an account into three categories using the previous api.

  • last_login_time - the last time you directly logged into a google service using a UI
  • last_web_mail_time - the last time you logged into gmail.com webmail
  • last_pop_time - the last time you popped or imap'ed from their server. (indirect login)

In the new SDK, I don't see a specific "How we populate this" comment within their documentation. I'm wondering, and having trouble testing to figure out the rules myself:

  1. How this is populated?
  2. If it is not all encompassing usage that updates this date (usage meaning ANY interaction between the user and their account), how do I get other dates?

I use the last usage date to recycle idle users. Thus I need an accurate representation of what this date is. I've tested, and it appears popping from a google account is not represented within the SDK LastLoggedIn property, even though you need to log in to pop. Thus, any user that pops from the account and doesn't "Log In" could be deleted by accident.

API Reference

Appreciate any help.

DFTR
  • 861
  • 10
  • 30

1 Answers1

0

These three (And more) properties still exist, just not attached to the "LastLoginTime". If you want to know if an account is truly idle, you'll need to use the Google.Apis.Admin.Reports.reports_v1 API. You can install via NuGet.

After you make your service object (Many stack answers can show you how to do this), usage is below:

UserUsageReportResource resource = _service.UserUsageReport;
UserUsageReportResource.GetRequest request = resource.Get("User@domain.ca", "yyyy-mm-dd");
UsageReports report = request.Execute();

All the interaction dates will need to be searched through, including LastLoginTime, and then take the latest. Each application has different dates all pertaining to when the last time the user did X action.

LastLoginTime appears to be simply the last time a user directly, or indirectly (via device), logged into the Gmail service. This does not include logging in for pop etc.

DFTR
  • 861
  • 10
  • 30