Share via


SPWebServer.Id property

Gets the GUID for the Web server.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

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