Get-SPOSite

Nani Ramos 1 Reputation point
2022-11-26T23:32:12.103+00:00

Would like to filter all site collection owners using WorkEmail instead of UPN. Is this possible? Can I also filter owners of all site collections that owners are M365 group? TIA!

Microsoft 365 and Office | SharePoint Server | For business
Microsoft 365 and Office | SharePoint | For business | Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Xyza Xue_MSFT 30,256 Reputation points Microsoft External Staff
    2022-11-28T07:22:10.82+00:00

    Hi @Nani Ramos ,

    1. In Office 365/SharePoint Online, the user's account(UPN) is their email address. Cannot be filtered directly through WorkEmail.
      Powershell to filter all site collection owners: $AdminCenterURL = "https://domain-admin.sharepoint.com/"
      $user="xyza@keyman .onmicrosoft.com" #Connect to SharePoint Online
      Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)
      #Get Site owners of all site collections
      Get-SPOSite -Filter "Owner -like '$($user)'" | Select URL, Owner

    264616-image.png
    2.After my internal and external search and testing, could not achieve filter owners of all site collections that owners are M365 group.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.