Alerts.DeleteAlerts Method

Deletes the specified alerts within a Web site.

Namespace:  [Alerts Web service]
Web service reference: http://Site/_vti_bin/Alerts.asmx


<SoapDocumentMethodAttribute("", RequestNamespace := "",  _
    ResponseNamespace := "",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function DeleteAlerts ( _
    IDs As String() _
) As DeleteFailure()
Dim instance As Alerts
Dim IDs As String()
Dim returnValue As DeleteFailure()

returnValue = instance.DeleteAlerts(IDs)
[SoapDocumentMethodAttribute("", RequestNamespace = "", 
    ResponseNamespace = "", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public DeleteFailure[] DeleteAlerts(
    string[] IDs


  • IDs
    Type: []

    A string array that contains the GUIDs of alerts to delete.

Return Value

Type: []
A DeleteFailure array that contains the alert ID and error status of unsuccessful deletions.
To access the Alerts service and its methods, set a Web reference to https://Server_Name/[sites/][Site_Name/]_vti_bin/Alerts.asmx.


The following code example deletes all the alerts from the current site.

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

Dim alertInfo As Web_Reference_Folder_Name.AlertInfo = alertService.GetAlerts()
Dim alerts As Web_Reference_Folder_Name.Alert() = alertInfo.Alerts
Dim delString(alerts.Length) As String
Dim i As Integer

For i = 0 To delString.Length - 1
    delString(i) = alerts(i).Id.ToString()
Next i
    Catch ex As Exception
End Try
Web_Reference_Folder_Name.Alerts alertService = new Web_Reference_Folder_Name.Alerts();
alertService.Credentials= System.Net.CredentialCache.DefaultCredentials;

Web_Reference_Folder_Name.AlertInfo alertInfo = alertService.GetAlerts();
Web_Reference_Folder_Name.Alert[] alerts = alertInfo.Alerts;

string[] delString = new string[alerts.Length];

for (int i=0; i<delString.Length; i++)
    delString[i] = alerts[i].Id.ToString();
catch(Exception ex)

The example uses the GetAlerts method to return information about the alerts, assigns the returned information to an array of alerts, and assigns the GUID of each alert in the array to a string array that is passed to the DeleteAlerts method.

See Also


Alerts Class

Alerts Members

Alerts Web Service