0

We have shared many files with a guest user account (using his gmail account), using these steps:-

  1. Access the document advance permission page

  2. Stop permission inheritance

enter image description here

  1. "Grant permission" access to the external user account >> with contribute permission

enter image description here

  1. The external user get an email to access the file >> for the first time the external user where asked to create a Microsoft account and can access the file

  2. now we wanted to remove the user access on all the files on all the site >> so from Office 365 admin >> under Guest >> i removed the guest account >> then i removed from the delete user list using this command:-

    Remove-AzureADMSDeletedDirectoryObject -Id 7******4

  3. but the external user can still access all the files + his username is still mentioned inside the document advanced permission setting.

enter image description here

so till when the guest account can access the files, even that we completely removed him/her guest account?

now for one hour >> the user can directly access the file from the email sent to him >> then after an hour when the user click on the invitation link >> the user will be asked to register again and can access the file. any advice on this scenario?

Thanks

2 Answers 2

0

You need to remove the guest user's permissions to the file (the file has unique permissions). This is the best way of ensuring the user no longer has access to the file in your scenario. You can then delete their account.

2
  • but we have around 50 guest users and 20 sites, we have been sharing files/folders with the 50 guest accounts, it will be hard to do this on per file basis., so is there a more standard way.. also i can not understand how a guest account can still access a file while his guest account was removed from our tenant!! May 13 at 16:04
  • Sounds like you need to revoke the invitation, to stop them re-accepting it via the email. Not sure how you do that. May 13 at 16:06
0

You can use PowerShell to remove users from a CSV file.

Here are steps:

1.Create a CSV file and fill it in according to your requirements, then Format as Table.

UserID needs to be prefixed: i:0#.f|membership|

enter image description here

2.PowerShell

#Variables
$CSVPath  ="C:\Users.csv"
 
#Get data from CSV
$CSVData = Import-Csv $CSVPath
 
#Iterate through each row in CSV
ForEach($Row in $CSVData)
{
    Try {
        #Connect to SharePoint Online Site            
        Connect-PnPOnline -Url $Row.SiteURL -Interactive
  
        #Remove user 
        Remove-PnPUser -Identity $Row.UserID -Force            
    }
    Catch {
        write-host -f Red "Error Removing User:" $_.Exception.Message
    }
}
1
  • but why we have to do this manually,, i assume that deleting a guest account will do this for us behind the scenes May 29 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.