azureazure-active-directorymicrosoft-graph-apiazure-ad-b2b

Azure Active Directory B2B Pending and Accepted User Reports


I have a requirement in which I need to get a list of Azure AD B2B users who haven't accepted the invitation using csom or rest api

Can you please let me know whether graph provides any such endpoints?


Solution

  • According to my research, we can use Microsoft Graph User API to implement it. The user's property externalUserState represents the invited user's invitation status. For invited users, the state can be PendingAcceptance or Accepted, or null for all other users. But please note that if you want to use Microsoft Graph User API to get the property, we need to beta version enter image description here For example

    1. Get all users externalUserState
    Get https://graph.microsoft.com/beta/users?$select=externalUserState,displayName,id
    Authorization: Bearer <access_token>
    

    enter image description here

    1. Get all users who haven't accepted the invitation
    https://graph.microsoft.com/beta/users?$select=externalUserState,displayName,id&$filter=externalUserState eq 'PendingAcceptance'
    Authorization: Bearer <access_token>
    

    enter image description here