SPVirtualServerCollection Class

The SPVirtualServerCollection class represents a collection of SPVirtualServer objects.

System.Object

   Microsoft.SharePoint.Administration.SPVirtualServerCollection

Public Properties

The following table shows the public properties of the SPVirtualServerCollection class, the data type of each property, and a brief description of each.

Name Data Type Description
Count Int32 Gets the number of virtual servers in the collection.
Item Microsoft.SharePoint.Administration.SPVirtualServer Gets the virtual server object at the specified index in the collection.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Remarks

Use the VirtualServers property of the SPGlobalAdmin class to return all the virtual servers in the deployment of Microsoft Windows SharePoint Services. To create an administrative virtual server, use the CreateAdminVirtualServer method of the SPGlobalAdmin class. To extend a virtual server, use one of the ExtendVirtualServer methods of the SPGlobalAdmin class.

Use an indexer to return a single virtual server from the collection. For example, if the collection is assigned to a variable named myVirtualServers, use myVirtualServers[index] in C#, or myVirtualServers(index) in Visual Basic .NET, where index is the index number of the server in the collection.

Example

The following code example iterates through the collection of virtual servers in a deployment and extends virtual servers that have not been extended with Windows SharePoint Services and creates a top-level site for each.

This example assumes the presence of an administrative form digest in the .cs or .vb file. For information on security validation, see Security Validation and Making Posts to Update Data.

Requirements

Namespace: Microsoft.SharePoint.Administration

Platforms: Microsoft Windows Server 2003

Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)

Security: Code Access Security