Share via


SPVirtualServer.Sites property

NOTE: This API is now obsolete.

Obsolete. Gets the collection of all site collections on the virtual server.

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

Syntax

'Declaration
<ObsoleteAttribute("Use SPWebApplication or SPIisSettings instead.",  _
    False)> _
Public ReadOnly Property Sites As SPSiteCollection
    Get
'Usage
Dim instance As SPVirtualServer
Dim value As SPSiteCollection

value = instance.Sites
[ObsoleteAttribute("Use SPWebApplication or SPIisSettings instead.", 
    false)]
public SPSiteCollection Sites { get; }

Property value

Type: Microsoft.SharePoint.Administration.SPSiteCollection
An SPSiteCollection object that represents the site collections.

Examples

The following code example uses the Sites property to create a top-level site in the site collection of a specified virtual server.

Dim globalAdmin As New SPGlobalAdmin()
Dim siteCollections As SPSiteCollection = globalAdmin.VirtualServers(0).Sites

Dim newSPSite As SPSite = siteCollections.Add("sites/Site_Name", _
    + "DOMAIN\User", "Email_Address")
SPGlobalAdmin globalAdmin = new SPGlobalAdmin();
SPSiteCollection siteCollections = globalAdmin.VirtualServers[0].Sites;

SPSite newSPSite = siteCollections.Add("sites/Site_Name", 
    "DOMAIN\\User", "Email_Address");

See also

Reference

SPVirtualServer class

SPVirtualServer members

Microsoft.SharePoint.Administration namespace