"Something Went Wrong, Failed To Accept Invitation" Error For External User In SharePoint Online

Sometimes, SharePoint Online external user sees “Something Went Wrong, Failed to Accept Invitation” error whenever he/she tries to access SharePoint Online site.
 
SharePoint

Reason

This issue is caused by a user incorrectly accepting a SharePoint Online invitation. This usually happens when a user is already signed into a Microsoft account (usually personal account) in their browser, and then copies over the invitation link to the browser. Anytime an invitation link is accepted by an account other than the intended recipient, there is an association created between the two accounts, that prevents the user from signing into SharePoint Online with the intended email address (account).

Resolution

The resolution to the “Failed to Accept Invitation” error is to use PowerShell to completely remove the user’s account from SPO, and re-send the invitation. Users need to make sure that they are completely logged out of any personal accounts from their browser before accepting the SPO invitation.
 
Below script can be used for removing the user from SharePoint Online.
  1. #Change your tenant admin account below  
  2. $username = "youaccount@<tenant>.onmicrosoft.com"  
  3. $password = read-host "Enter your Password" -AsSecureString   
  4. #$password = convertto-securestring "YourPassword" -asplaintext -force  
  5. $cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $password  
  6.  
  7. #Must be SharePoint Admin URL  
  8. $siteUrl = "https://<tenant>-admin.sharepoint.com"  
  9.   
  10. Connect-SPOService -Url $siteUrl -Credential $cred  
  11. $extUserDetail = read-host "Enter external user id (<user-email>#EXT#@<tenant>.onmicrosoft.com)"   
  12.   
  13. $extUser = Get-SPOExternalUser -filter $extUserDetail   
  14.   
  15. Write-Host "1. Display External User" -ForegroundColor Green  
  16. Write-Host "2. Remove External User" -ForegroundColor Magenta  
  17.   
  18. $choice = Read-Host "Choice [1-2]?"  
  19.   
  20. switch ($choice)   
  21.     {   
  22.         1 { $extUser }   
  23.         2 { Remove-SPOExternalUser -UniqueIDs @($extUser.UniqueId) }   
  24.           
  25.         default {":-) You must be kidding."}  
  26.     }