1

How can I fetch all the alerts from all the Site Collections in SharePoint Online/Office 365 using PowerShell script?

1

2 Answers 2

0

Unfortunately, there are no PowerShell Scripts available to retreive alerts from SharePoint Online (yet).

See: Index of Windows PowerShell for SharePoint Online cmdlets

-1

Here is the sample script you can try to fetch all the alerts created in SharePoint online.

Config Variables

$SiteURL = "https://my.sharepoint.com/sites/GA"

Connect to PNP Online

Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)

Fetch all the users from SharePoint online site

$users = Get-PnPUser

foreach($user in $users) { $alerts = Get-PnPAlert -User $user #Check if user has any alerts created or not. if($alerts -ne $null) { #Display the user details and alert title Write-host -Object $user.Title, $user.email, $alerts.Title } }

Note: This can only be executed for site collection admin or owners permission. Pnp powershell you would need to install. Ref: https://github.com/SharePoint/PnP-PowerShell

1
  • this approach worked for me, but only for small sites (a few site users). When number of site users is big - the loop will lasts forever... Oct 2, 2021 at 16:42

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.