RefreshSnapshots Method

SPDatabaseSnapshotCollection.RefreshSnapshots Method

Queries the database to ensure that the SPDatabaseSnapshotCollection object represents the current list of all database snapshots of the database.

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

public void RefreshSnapshots()

The population of database snapshots for a database is highly dynamic because new database snapshots are created on a regular schedule and old database snapshots are deleted automatically when they reach their maximum allowed age. For this reason, the membership of an SPDatabaseSnapshotCollection object can become out-of-date. Use the RefreshSnapshots() method to ensure that, for example, the Count property is accurate and that the Snapshots property of the parent SPDatabase object is accurate.

The RefreshSnapshots() method makes a round trip to Microsoft SQL Server and can decrease performance if called frequently. For example, if you are iterating over items in the collection, calling RefreshSnapshots() can decrease performance.

© 2016 Microsoft