다음을 통해 공유


SPDatabaseSnapshotCollection.MaximumRetention property

Gets or sets the time, in hours, that a database snapshot is saved before it is automatically deleted.

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

Syntax

'Declaration
Public Property MaximumRetention As Short
    Get
    Set
'Usage
Dim instance As SPDatabaseSnapshotCollection
Dim value As Short

value = instance.MaximumRetention

instance.MaximumRetention = value
public short MaximumRetention { get; set; }

Property value

Type: System.Int16
The lifespan of a database snapshot in hours.

Exceptions

Exception Condition
ArgumentOutOfRangeException

An attempt is made to assign to this property a value is greater than 500 or a negative number.

Remarks

MaximumRetention cannot be set to more than 500.

The MaximumRetention property is ignored by the built-in database snapshot management system of SharePoint Foundation if EnabledManagement is false.

You must call Update() to save changes to this property.

Examples

In the following example, db is an SPDatabase object.

db.Snapshots.MaximumRetention = 24; db.Update();

See also

Reference

SPDatabaseSnapshotCollection class

SPDatabaseSnapshotCollection members

Microsoft.SharePoint.Administration.Backup namespace