Share via


SPIisWebSite.ServerState property

Gets a value that describes the server state.

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

Syntax

'Declaration
Public ReadOnly Property ServerState As SPIisWebSite.SPIisServerState
    Get
'Usage
Dim instance As SPIisWebSite
Dim value As SPIisWebSite.SPIisServerState

value = instance.ServerState
public SPIisWebSite.SPIisServerState ServerState { get; }

Property value

Type: Microsoft.SharePoint.Administration.SPIisWebSite.SPIisServerState
An SPIisWebSite.SPIisServerState value that describes the server state.

Remarks

This property specifies the server state; if the server is not yet in this state, the implementation will cause the server to change state.

Examples

The following code displays the state of the server for the local SharePoint Foundation farm

[C#]

SPSite oSiteCollection = new SPSite("https://localhost");
string strNewName;
Uri uri = new Uri(oSiteCollection.Url); 
SPWebApplication webApp = SPWebApplication.Lookup(uri);
int instID = webApp.IisSettings[SPUrlZone.Default].PreferredInstanceId;
SPIisWebSite iisWebSite = new SPIisWebSite(instID);
Console.WriteLine("*>>> SPIISWebsite Instance Id " + iisWebSite.InstanceId);
Console.WriteLine("*>>> Server State             " + iisWebSite.ServerState);

See also

Reference

SPIisWebSite class

SPIisWebSite members

Microsoft.SharePoint.Administration namespace