Overview of users who have set a warning for a SharePoint site.

Tom Blokhuis 0 Reputation points
2024-11-05T09:52:04.45+00:00

How can I generate an overview of people who have set a user warning for a specific sharepoint site.

I have admin rights when it comes to the Microsoft sharepoint environment.

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,112 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Yanli Jiang - MSFT 27,641 Reputation points Microsoft Vendor
    2024-11-08T09:42:16.64+00:00

    Hi @Tom Blokhuis ,

    According to Manage, view, or delete SharePoint alerts, you can manage or delete alerts for yourself and for other users if you are a site admin.

    User's image

    Good day!


    If the answer is helpful, please click "Accept as 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.


  2. Yanli Jiang - MSFT 27,641 Reputation points Microsoft Vendor
    2024-11-12T09:11:19.4266667+00:00

    Hi @Tom Blokhuis ,

    Unfortunately, according to the previous article, in User Alerts, you can only query whether other users have alerts, and if so, you can only delete them, but cannot view or edit them in detail. In other words, you cannot know which library or list this alert is for, and there is no way to determine it.

    Therefore, we recommend that you use PowerShell:

    #Load SharePoint CSOM Assemblies
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
        
    Function Get-SPOWebAlerts($SiteURL)
    {
        Try {
            #Setup the context
            $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
            $Ctx.Credentials = $Cred
             
            Write-host -f Yellow "Getting Alerts in the site" $SiteURL
            #Get All Alerts from the Web
            $Web = $Ctx.Web
            $WebAlerts = $Web.Alerts
            $Ctx.Load($Web)
            $Ctx.Load($web.Webs)
            $Ctx.Load($WebAlerts)
            $Ctx.ExecuteQuery()
     
            If($WebAlerts.count -gt 0) { Write-host -f Green "Found $($WebAlerts.Count) Alerts!"}
     
            $AlertCollection = @()
            #Loop through each alert of the web and get alert details
            ForEach($Alert in $webAlerts)
            {
                #Get Alert list and User
                $Ctx.Load($Alert.User)
                $Ctx.Load($Alert.List)
                $Ctx.ExecuteQuery()
     
                $AlertData = New-Object PSObject
                $AlertData | Add-Member NoteProperty SiteName($Web.Title)
                $AlertData | Add-Member NoteProperty SiteURL($Web.URL)
                $AlertData | Add-Member NoteProperty AlertTitle($Alert.Title)
                $AlertData | Add-Member NoteProperty AlertUser($Alert.User.Title)
                $AlertData | Add-Member NoteProperty AlertList($Alert.List.Title)
                $AlertData | Add-Member NoteProperty AlertFrequency($Alert.AlertFrequency)
                $AlertData | Add-Member NoteProperty AlertType($Alert.AlertType)
                $AlertData | Add-Member NoteProperty AlertEvent($Alert.EventType)
                           
                #Add the result to an Array
                $AlertCollection += $AlertData
            }
            #Export Alert Details to CSV file
            $AlertCollection | Export-CSV $ReportOutput -NoTypeInformation -Append
     
            #Iterate through each subsite of the current web and call the function recursively
            foreach ($Subweb in $web.Webs)
            {
                #Call the function recursively to process all subsites underneath the current web
                Get-SPOWebAlerts($Subweb.url)
            }
        }
        Catch {
            write-host -f Red "Error Getting Alerts!" $_.Exception.Message
        }
    }
     
    #Config Parameters
    $SiteURL= "https://crescent.sharepoint.com/"
    $ReportOutput="C:\Temp\AlertsRpt.csv"
     
    #Delete the Output Report, if exists
    if (Test-Path $ReportOutput) { Remove-Item $ReportOutput }
     
    #Setup Credentials to connect
    $Cred = Get-Credential
    $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
     
    #Call the function
    Get-SPOWebAlerts $SiteURL
    

    This PowerShell script gets alerts created in a site collection and generates a CSV file with all alerts in the provided site collection.

    Reference:

    https://www.sharepointdiary.com/2017/11/sharepoint-online-powershell-to-get-all-alerts-from-site-collection.html

    Non-official, just for reference.

    Good day!


    If the answer is helpful, please click "Accept as 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.


Your answer

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