0

How to check a Google app account is present in a domain or not using Google app script (with email id)?

I would like to reset the password of accounts in my domain. Before that i need to check if those accounts exists in my domain or not. So with a given email id, i need to check id this particular email id is present in my domain or not and it should be primary email address.

Please let me know if this is feasible or not.

Thanks

Kanchan
  • 65
  • 2
  • 11

1 Answers1

0

I think you can try to retrieve all users in your domain by following this documentation.

To retrieve all users in the same domain, use the following GET request and include the authorization described in Authorize requests. For readability, this example uses line returns:

GET https://www.googleapis.com/admin/directory/v1/users ?domain=primary domain name&pageToken=token for next results page
&maxResults=max number of results per page
&orderBy=email, givenName, or familyName
&sortOrder=ascending or descending
&query=email, givenName, or familyName:the query's value*

Also check this SO question, if it can help you.

Community
  • 1
  • 1
KENdi
  • 7,576
  • 2
  • 16
  • 31