Alerts.DeleteAlerts method

Deletes the specified alerts within a Web site.

Namespace:  WebSvcAlerts
Assembly:  STSSOAP (in STSSOAP.dll)

[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/DeleteAlerts", 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 DeleteFailure[] DeleteAlerts(
	string[] IDs
)

Parameters

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 http://Server_Name/[sites/][Site_Name/]_vti_bin/Alerts.asmx.

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

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();
}
try
{
    alertService.DeleteAlerts(delString);
}
catch(Exception ex)
{
    MessageBox.Show(ex.Message);
}

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.

Show: