google-admin-sdk - GSuite - 上次电子邮件活动
问题描述
我正在尝试使用 GSuite Admin SDK 创建一个 GSuite 集成,它将获取用户列表和他们上次活动的日期时间。我能够获取上次登录时间,但我找不到使用 POP 或 IMAP 电子邮件客户端的用户查找上次电子邮件活动的方法。
我试图获取的数据在管理控制台中可用:
但是有没有办法使用 Gsuite Admin SDK 来获取它?
解决方案
我找到了一个为用户获取电子邮件活动的解决方案,但 API 参考中的示例并不那么简单,它们分散在几个页面上。我最终使用了 GSuite Reports API 中的用户使用情况报告(如对原始问题的评论中所建议):https ://developers.google.com/admin-sdk/reports/v1/guides/manage-usage-users
示例调用:
GET https://www.googleapis.com/admin/reports/v1/usage/users/all/dates/2018-05-21?parameters=classroom:last_interaction_time,accounts:last_login_time,accounts:last_sso_time,gmail:last_access_time,gmail:last_imap_time,gmail:last_interaction_time,gmail:last_pop_time,gmail:last_webmail_time
通过这种方式,我不仅可以获得电子邮件活动,还可以获得 Classroom 上次交互时间和 GSuite 上次登录时间和上次 SSO 时间。
示例用户响应:
"entity": {
"type": "USER",
"customerId": "customerId",
"userEmail": "sample@email.com",
"profileId": "profileId"
},
"parameters": [
{
"name": "classroom:last_interaction_time",
"datetimeValue": "1970-01-01T00:00:00.000Z"
},
{
"name": "accounts:last_login_time",
"datetimeValue": "2018-05-18T14:46:11.000Z"
},
{
"name": "accounts:last_sso_time",
"datetimeValue": "1970-01-01T00:00:00.000Z"
},
{
"name": "gmail:last_access_time",
"datetimeValue": "2018-05-18T08:43:15.000Z"
},
{
"name": "gmail:last_imap_time",
"datetimeValue": "1970-01-01T00:00:00.000Z"
},
{
"name": "gmail:last_interaction_time",
"datetimeValue": "2018-04-23T07:08:40.000Z"
},
{
"name": "gmail:last_pop_time",
"datetimeValue": "1970-01-01T00:00:00.000Z"
},
{
"name": "gmail:last_webmail_time",
"datetimeValue": "2018-04-23T07:08:44.000Z"
}
]
推荐阅读
- xamarin.forms - 创建 xamarin 跨平台移动应用程序(android、ios 和 windows)的步骤
- elasticsearch - ElasticSearch Indicies 的数量是否有限制?
- python - 如何推断 Python 构造中数据结构字段的值?
- javascript - 类型 'A | 上不存在属性 'prop' 乙'
- c++ - 本地主机的 IWebViewControl
- maven - 无法在项目自动化上执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test):有测试失败
- caching - 无法从用户缓存 Google Apps 脚本中检索对象
- .net - 使用 WinSCP .NET 找不到方法异常 (EventWaitHandle..ctor)
- javascript - 将模块的多个命名导出导入单个对象
- javascript - jQuery按钮一键两用功能