SharePoint Online: How to Check If an External User has Accepted the Invitation?

Requirement: Check if an External user has accepted the invitation or not.

How to Check If an External User has Accepted the Invitation?
A user who is not part of your organization is considered to be external. You may need to collaborate with them at times, such as a freelancer from another organization helps you to complete a project.  We can invite an external user to our environment. The external user we are sharing with will receive an email with a link to the shared item, such as site or document link. But how do we check if the person we are sharing with has accepted the invitation?

Case 1: Check the "Access Requests" List in SharePoint Online
You can log in to your SharePoint Online Site >> Click on Settings >> Site Settings >> Click on "Access requests and invitations" link to check all pending access requests and invitations. However, Recently I noticed that this interface has changed! you longer can get invitations and requests from this list. It looks like Microsoft completely locks you out of this list. Don't panic! We've PowerShell lifesaver!!

PowerShell to Export Access Requests List in SharePoint Online:
This PowerShell script exports all items from the access requests list to a CSV file.
#Config Parameter
$SiteURL = ""
$ListName = "Access Requests"
$CSVPath = "c:\Temp\AccessRequests.csv"
$AccessRequests= @()

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)

#Get all access requests
$ListItems = Get-PnPListItem -List $ListName | ForEach-Object {
    $AccessRequests += New-Object PSObject -Property ([Ordered]@{
        Title = $_.FieldValues.Title 
        RequestedObjectUrl = $_.FieldValues.RequestedObjectUrl.Url
        RequestedObjectTitle = $_.FieldValues.RequestedObjectTitle
        RequestedBy = $_.FieldValues.RequestedBy
        RequestedFor = $_.FieldValues.RequestedFor
        RequestDate = $_.FieldValues.RequestDate
        Expires = $_.FieldValues.Expires
        Status = $_.FieldValues.Status
        PermissionType = $_.FieldValues.PermissionType
        IsInvitation = $_.FieldValues.IsInvitation      
#Export the result Array to CSV file
$AccessRequests | Export-CSV $CSVPath -NoTypeInformation

You can check the "Status" column value to determine the status of the invitation. The status codes are:
Status code Status description
0 The access request or invitation is pending.
1 The access request has been approved.
2 The invitation has been accepted.
3 The access request has been denied.
4 The invitation has expired.
5 The invitation has been revoked.

Case 2: Check the External User Invitation Status in Azure AD
If your external sharing settings allow only existing users in the organization, then you must add the user to Azure AD first by inviting them. Once they accept the invitation, their account gets created in Azure AD. Alright, How do we check if the user invited has accepted the invitation?
  • Login to and open Azure Active Directory module
  • Search and find the Invited user. Click on the user account to get invited User's profile
  • On the User profile page, You can check if the invitation has been accepted or not under "Invitation accepted"!   Also, If the source field is "invited user" it means the user has not yet accepted the invitation.
    azure ad check if external user invitation is accepted
You can also check invitation status using PowerShell as:
#Connect to Azure AD
Connect-azureAD -Credential (Get-Credential)

#Get All Users with pending acceptance
Get-AzureADUser -Filter "UserState eq 'PendingAcceptance'" | Format-List -Property DisplayName,UserPrincipalName,UserState

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.