I need to set a property on all userprofiles within a tenant.
It doesnt seem possible to get all user profiles from "UPA" via CSOM and powershell.
Its possible (in theory) to loop trough all sitecollections and add all users so maybe some array and afterwards only select unique from that array (to remove duplicates):
$sites = Get-SPOSite | select *foreach ($site in $sites) {
Get-SPOUser -Site $site
...and so on
And then loop trough that array and use csom:
$pMAn = New-Object Microsoft.SharePoint.Client.UserProfiles.PeopleManager($context)
$userProfile = $pMan.GetPropertiesFor($user.LoginName)
$ctx.Load($userProfile)
$ctx.ExecuteQuery()
$pMan.SetSingleVlueProfileProperty($userProfile.AccountName, "property", $value)
$ctx.ExecuteQuery()
Anyone who can think of a smarter solution?