如何在 google admin sdk 中查找用户
How to find user in google admin sdk
我想知道我的 Gmail 上是否存在具有特定用户名的用户。到目前为止我试过:
String query = "email='"+username+"@my.domain.com'";
users = directoryService.users().list().setQuery(query).execute();
但我只得到:
13:47:12.654 [1651372403@qtp-1044945601-1] ERROR p.e.u.d.g.a.m.SDKGAManagementServiceImpl(153) - com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Bad Request",
"reason" : "badRequest"
} ],
"message" : "Bad Request"
}
我尝试查询具有已知用户名的用户,但得到了想要的响应,因此我确定问题出在此处。有人可以提供帮助吗?
如果你想使用admin sdk 找到用户,那么你应该给出类似query=email=xxxx@domain.com 的查询。此外,即使文档中未提及,对于 users.list,您也应该提供域名。
在给出以上参数后,我就能够成功找到用户了。如果您有任何问题,请告诉我。
我想知道我的 Gmail 上是否存在具有特定用户名的用户。到目前为止我试过:
String query = "email='"+username+"@my.domain.com'";
users = directoryService.users().list().setQuery(query).execute();
但我只得到:
13:47:12.654 [1651372403@qtp-1044945601-1] ERROR p.e.u.d.g.a.m.SDKGAManagementServiceImpl(153) - com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Bad Request",
"reason" : "badRequest"
} ],
"message" : "Bad Request"
}
我尝试查询具有已知用户名的用户,但得到了想要的响应,因此我确定问题出在此处。有人可以提供帮助吗?
如果你想使用admin sdk 找到用户,那么你应该给出类似query=email=xxxx@domain.com 的查询。此外,即使文档中未提及,对于 users.list,您也应该提供域名。
在给出以上参数后,我就能够成功找到用户了。如果您有任何问题,请告诉我。