Alerts.GetAlerts Method (Alerts)
Returns information about the alerts within a Web site.

Web Service: AlertsWeb Reference: http://<Site>/_vti_bin/Alerts.asmx
Syntax

Visual Basic (Declaration)
<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/GetAlerts", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function GetAlerts As AlertInfo
Visual Basic (Usage)
Dim instance As Alerts
Dim returnValue As AlertInfo

returnValue = instance.GetAlerts
C#
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/GetAlerts", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public AlertInfo GetAlerts ()

Return Value

An AlertInfo structure whose fields contain information about each alert, as well as the URL of the page for managing alerts on the site, the name of the server, the type of site definition used to create the site (for example, STS), the URL of the site, the GUID identifying the site, the title of the site, the display name of the current user, and the URL of the page used for choosing a list or document library when creating an alert through the My Alerts on this Site page.
Remarks

To access the Alerts service and its methods, set a Web reference to http://Server_Name/[sites/][Site_Name/]_vti_bin/Alerts.asmx.

Example

The following code example displays information about the alerts for the current site.

Visual Basic
Dim alertService As New Web_Reference_Folder_Name.Alerts()
alertService.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim allAlerts As Web_Reference_Folder_Name.AlertInfo = alertService.GetAlerts()

MessageBox.Show("Server: " + allAlerts.AlertServerName + ControlChars.Lf + _
    "URL: " + allAlerts.AlertServerUrl + ControlChars.Lf + _
    "Web Title: " + allAlerts.AlertWebTitle + ControlChars.Lf + _
    "Number: " + allAlerts.Alerts.Length.ToString())
C#
Web_Reference_Folder_Name.Alerts alertService = new Web_Reference_Folder_Name.Alerts();
alertService.Credentials= System.Net.CredentialCache.DefaultCredentials;

Web_Reference_Folder_Name.AlertInfo allAlerts = alertService.GetAlerts();

MessageBox.Show("Server: " + allAlerts.AlertServerName +
    "\nURL: " + allAlerts.AlertServerUrl +
    "\nWeb Title: " + allAlerts.AlertWebTitle +
    "\nNumber: " + allAlerts.Alerts.Length.ToString());
See Also

Tags :


Page view tracker