Condividi tramite


SPWebServer.Id Property

Gets the GUID for the Web server.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public ReadOnly Property Id As Guid
    Get
'Usage
Dim instance As SPWebServer
Dim value As Guid

value = instance.Id
public Guid Id { get; }

Property Value

Type: System.Guid
The GUID for the Web server.

Examples

The following code example from a console application uses the Id property to display the GUID of each Web server in the SharePoint Foundation deployment.

Dim globalAdmin As New SPGlobalAdmin()
Dim webServers As SPWebServerCollection = globalAdmin.Config.WebServers
Dim webServer As SPWebServer

For Each webServer In  webServers
    Console.WriteLine(webServer.Id.ToString() + "\n")
Next webServer

Console.ReadLine() 
SPGlobalAdmin globalAdmin = new SPGlobalAdmin();
SPWebServerCollection webServers = globalAdmin.Config.WebServers;

foreach (SPWebServer webServer in webServers)
{
    Console.WriteLine(webServer.Id.ToString() + "\n");
}

Console.ReadLine();

See Also

Reference

SPWebServer Class

SPWebServer Members

Microsoft.SharePoint.Administration Namespace