Get alerts from SharePoint 2010 site using web service in powershell

Navigate to the SharePoint site. Go to Site Actions, and then click on Site Settings. In the Site Administration section, click on User Alerts. Select the user from the drop down and then click on Update button. You could be able to view all the alerts for the selected user.


 

Steps Involved:

  1. Open SharePoint 2010 Management Shell by going to Start | All Programs | SharePoint | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell (Run as Administrator).
  2. Run the following script.

Powershell Script:

 
 
## Get alerts for the current user from the site using SharePoint 2010 web service in powershell
$uri="http://serverName:10736/sites/ECT2/_vti_bin/Alerts.asmx?wsdl"

$credential=Get-Credential
## Web Service Reference - http://Site/_vti_bin/Alerts.asmx
$alertsWebServiceReference = New-WebServiceProxy -Uri $uri -Credential $credential
$alertInfo=$alertsWebServiceReference.GetAlerts()
Write-Host -ForegroundColor Magenta "Alert Information: "
Write-Host -ForegroundColor Yellow "CurrentUser: " $alertInfo.CurrentUser
Write-Host -ForegroundColor Yellow "AlertWebTitle: " $alertInfo.AlertWebTitle
Write-Host -ForegroundColor Yellow "AlertServerName: " $alertInfo.AlertServerName
Write-Host -ForegroundColor Yellow "AlertServerType: " $alertInfo.AlertServerType
Write-Host -ForegroundColor Yellow "AlertServerUrl: " $alertInfo.AlertServerUrl
Write-Host -ForegroundColor Yellow "Alerts Number: " $alertInfo.Alerts.Length.ToString()
Write-Host -ForegroundColor Green "Getting all the alerts for the current user......."
foreach($alert in $alertInfo.Alerts)
{
Write-Host -ForegroundColor Yellow "Title: " $alert.Title
Write-Host -ForegroundColor Yellow "AlertForUrl: " $alert.AlertForUrl
Write-Host -ForegroundColor White "---------------------------------------------------------------------"
}


Output:

output.jpg


Ebook Download
View all
Learn
View all