共用方式為


Alerts.GetAlerts Method

Returns information about the alerts within a Web site.

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

Syntax

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

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

Return Value

Type: [Alerts Web service].AlertInfo
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 https://Server_Name/[sites/][Site_Name/]_vti_bin/Alerts.asmx.

Examples

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

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())
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

Reference

Alerts Class

Alerts Members

Alerts Web Service