Поделиться через


SPContentDatabaseCollection Class

The SPContentDatabaseCollection class represents a collection of SPContentDatabase objects.

System.Object

   Microsoft.SharePoint.Administration.SPContentDatabaseCollection

Public Constructors

The following table shows the public constructors of the SPContentDatabaseCollection class and a brief description of each.

Name Description
SPContentDatabaseCollection Initializes a new instance of the SPContentDatabaseCollection class.

Public Methods

The following table shows the public methods of the SPContentDatabaseCollection class and a brief description of each.

Name Description
Add Adds a content database to the collection of content databases on the virtual server.
Delete Deletes the content database with the specified GUID.

Public Properties

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

Name Data type Description
Count Int32 Gets the number of content databases in the collection.
Item(Int32) Microsoft.SharePoint.Administration.SPContentDatabase Gets the content database object at the specified index in the collection.
Item(System.Guid) Microsoft.SharePoint.Administration.SPContentDatabase Gets the content database object with the specified GUID from the collection.

Thread Safety

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

Remarks

Use the ContentDatabases property of the SPVirtualServer class to return the collection of content databases for the virtual server. To add a content database, use the Add method represented in the first table in this topic.

Use an indexer to return a single content database from the collection. For example, if the collection is assigned to a variable named myContentDatabases, use myContentDatabases[index] in C#, or myContentDatabases(index) in Visual Basic .NET, where index is either the index number of the field in the collection or the GUID for the content database.

Example

The following code example displays information about the content databases of all the virtual servers in a Microsoft Windows SharePoint Services deployment.

Requirements

Namespace: Microsoft.SharePoint.Administration

Platforms: Microsoft Windows Server 2003

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

Security: Code Access Security