我正在尝试提取我的组织内所有用户的电子邮件地址。 我的 GraphQL 查询如下所示:
{
organization(login: "####") {
membersWithRole(first: 100) {
totalCount
edges {
node {
login
name
email
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
}
但是,它仅在用户公开显示电子邮件时才显示。我需要这个的原因是从我的组织中删除已离开/取消的用户。
谢谢
最佳答案
it only shows the email if the user has made it publicly shown.
是的,这意味着私有(private)电子邮件不会被查询,或者如 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.
如asked before ,单独使用电子邮件是行不通的,因为私有(private)电子邮件不会成为此类查询的一部分。
这可以给你 User node is null if email is private or unset .
您的情况需要其他方法,例如 Get last activity for a user in an organisation GitHub Ecosystem .
关于GitHub API 和电子邮件地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71951205/