Reputation: 16691
Im trying to pull the email addresses for all users within my org. My GraphQL query looks like this:
{
organization(login: "####") {
membersWithRole(first: 100) {
totalCount
edges {
node {
login
name
email
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
}
However, it only shows the email if the user has made it publicly shown. The reason I need this is to remove users from my org that have left/cancelled.
Thanks,
Upvotes: 2
Views: 593
Reputation: 1324258
it only shows the email if the user has made it publicly shown.
Yes, which means that private emails are not to be queried or, as explained here:
some users don't have an e-mail address defined in
github.com/settings/profile
and that causes the email field in the API response to be blank.
As asked before, using email alone won't work, since private emails would not be part of that kind of queries.
That can give you a User node is null if email is private or unset.
An other approach would be needed in your case, like, for instance, Get last activity for a user in an organisation GitHub Ecosystem.
Upvotes: 2