Change Primary Administrator of SharePoint Online Site using PnP PowerShell

Changing the Primary Administrator First connect to SharePoint Online admin center $connection = Connect-PnPOnline -Url https://YourTenant-admin.sharepoint.com -Credentials (Get-Credential) -ReturnConnection Then get the Site $site = Get-PnPTenantSite -Url https://YourTenant.sharepoint.com/sites/SiteAlias -Connection $connection Then update the Owner (same as Primary Administrator) using the new Primary Administrators Email/UserPrincipalName. $site.Owner = “user@domain.com” $site.Update() $site.Context.ExecuteQuery() Verifying the Primary Administrator Connect to […]

Use Array some() instead of forEach() if a break out is needed

When iterating an array with a need to break out at some point, I have always used the good old for loop instead of some other Array iteration variant. This is mainly due to the fact that .forEach() does not have a break out option – forcing the entire array to be iterated. But… while […]