Share via


SPWebServer.AdminPort property

Gets the administration port number for the Web server.

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

Syntax

'Declaration
Public ReadOnly Property AdminPort As Integer
    Get
'Usage
Dim instance As SPWebServer
Dim value As Integer

value = instance.AdminPort
public int AdminPort { get; }

Property value

Type: System.Int32
A 32-bit integer that specifies the port number.

Examples

The following code example from a console application uses the AdminPort property to display the administrative port number 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.AdminPort + "\n")
Next webServer

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

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

Console.ReadLine();

See also

Reference

SPWebServer class

SPWebServer members

Microsoft.SharePoint.Administration namespace