Azure Active Directory B2B 待定和已接受的用户报告

Azure Active Directory B2B Pending and Accepted User Reports

我有一个要求,我需要使用 csom 或 rest 获取尚未接受邀请的 Azure AD B2B 用户列表 api

能否请您告诉我 graph 是否提供任何此类端点?

根据我的研究,我们可以use Microsoft Graph User API实现它。用户的属性externalUserState代表被邀请用户的邀请状态。对于受邀用户,状态可以是 PendingAcceptance 或 Accepted,对于所有其他用户,状态可以是 null。但请注意,如果要使用 Microsoft Graph User API 获取 属性,我们需要 beta 版本 例如

  1. 获取所有用户externalUserState
Get https://graph.microsoft.com/beta/users?$select=externalUserState,displayName,id
Authorization: Bearer <access_token>

  1. 获取所有未接受邀请的用户
https://graph.microsoft.com/beta/users?$select=externalUserState,displayName,id&$filter=externalUserState eq 'PendingAcceptance'
Authorization: Bearer <access_token>