End User PowerShell - Grant site permission to users with bulk CSV

SPJeff
SPJeff
169 بار بازدید - پارسال - Live coding demo to grant
Live coding demo to grant site permission to users with bulk CSV.   Available to any end user and does not require SharePoint tenant admin, site collection admin, or high level access.

Cheers.

POWERSHELL SOURCE CODE

Connect to SPO using WebLogin
$siteUrl = "https://spjeffdev.sharepoint.com/site..."
Connect-PNPOnline -Url $siteUrl -UseWebLogin
Get-PnPWeb
Get-PnPList

Read CSV file
$csv = Import-Csv -Path "SPJeff-Grant-Site-Access.csv"

Loop each row in CSV and grant access to site
foreach ($row in $csv) {
   $user = $row.User
   $role = $row.Role
   Write-Host "Granting $user $role access to $siteUrl"
   Set-PnPWebPermission -User $user -AddRole $role
}
پارسال در تاریخ 1402/04/19 منتشر شده است.
169 بـار بازدید شده
... بیشتر