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 Whether an External User has Accepted the Invitation or Not?
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 helping you to complete a project. We can invite an external user to our environment. The external user we are sharing will receive an email with a link to the shared item, such as a site or document link. The external users must accept an invitation before accessing the shared site or document library. But how do we check if the person we share has accepted the invitation? In this article, we will discuss how to check if an external user has accepted the invitation in SharePoint Online.
Option 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 the “Access requests and invitations” link to check all pending access requests and invitations. However, Recently, I noticed that this interface has changed! You can no longer get invitations and requests from this list, and it looks like Microsoft completely locks you out of this list. Don’t panic! We have 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 = "https://crescent.sharepoint.com/sites/marketing"
$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
$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. |
Option 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 https://portal.azure.com and open the Azure Active Directory module.
- Search and find the invited user. Click on the user account to get the invited User’s profile.
- Click on “Overview” and then the “Properties” tab. On the User profile overview page, You can check whether the invitation has been accepted under “External user state”.
Alternatively, You can check the invitation status of an external user using the following PowerShell script:
#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
The above script will return the status of the external user’s invitation.
Conclusion:
In conclusion, SharePoint Online allows you to share content with external users, but it’s important to ensure that the external users have accepted the invitation to access the shared content. The process of checking if an external user has accepted the invitation can be done through the SharePoint UI or by using the PnP PowerShell module. The external users will have to accept an invitation before they can access the shared site or document library. Once they have accepted the invitation, they will be able to access the shared content. It’s also worth noting that SharePoint sends an email to the external user with an acceptance link, if the user hasn’t received the email, it might be in the spam folder, or the email is incorrect, so it’s better to double-check the email address before you share.
Great info – thanks a lot 🙂