Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets the name of the Web server.
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public ReadOnly Property Name As String
Get
'Usage
Dim instance As SPWebServer
Dim value As String
value = instance.Name
public string Name { get; }
Property value
Type: System.String
A string that contains the name of the Web server.
Examples
The following code example from a console application uses the Name property to display the name 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.Name + "\n")
Next webServer
Console.ReadLine()
Console.WriteLine("Press ENTER to continue")
SPGlobalAdmin globalAdmin = new SPGlobalAdmin();
SPWebServerCollection webServers = globalAdmin.Config.WebServers;
foreach (SPWebServer webServer in webServers)
{
Console.WriteLine(webServer.Name + "\n");
}
Console.ReadLine();
Console.WriteLine("Press ENTER to continue");