Condividi tramite


SPDatabaseSnapshotCollection Class

Represents a collection of SPDatabaseSnapshot objects that are Microsoft SQL Server database snapshots. This class also provides methods and properties for the management of the database snapshots.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.Administration.Backup.SPDatabaseSnapshotCollection

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

Syntax

'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public NotInheritable Class SPDatabaseSnapshotCollection _
    Inherits SPAutoSerializingObject _
    Implements IEnumerable(Of SPDatabaseSnapshot), IEnumerable
'Usage
Dim instance As SPDatabaseSnapshotCollection
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public sealed class SPDatabaseSnapshotCollection : SPAutoSerializingObject, 
    IEnumerable<SPDatabaseSnapshot>, IEnumerable

Remarks

An object of this class is always the value of the Snapshots property of an SPDatabase object.

Warning

If EnabledManagement is true, then database snapshots can be created and deleted automatically by timer jobs in the background. To help ensure that the SPDatabaseSnapshotCollection object represents the current set of database snapshots, always call the RefreshSnapshots() method before you access or process any members of the collection. This point applies also when you access a database snapshot through an indexer. For example, if spd is an SPDatabase object, the line spd.Snapshots[0] should be preceded by a call of the RefreshSnapshots() method.

Database snapshots can only be created by specific versions of Microsoft SQL Server. Use the IsSnapshotSupported property to determine if the Microsoft SQL Server hosting your database supports database snapshots.

You must call Update() of the parent SPDatabase object to persist changes to any properties of this collection.

Examples

In the following example, db is an SPDatabase object.

db.Snapshots.RefreshSnapshots();db.Snapshots.CreationInterval = 3; db.Update();

Thread Safety

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

See Also

Reference

SPDatabaseSnapshotCollection Members

Microsoft.SharePoint.Administration.Backup Namespace

Other Resources

Database Snapshots