This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.
The ReadFileList method returns a QueryResults object enumerating the Microsoft SQL Server database files maintained on a backup media.
A QueryResults object containing one result set defined by these columns.
Logical name for the database file.
Name of the operating system file implementing the database logical file.
When D, the operating system file maintains data. When L, the operating system file maintains log records.
Name of the filegroup to which the database file belongs. NULL for files maintaining log records.
Size, in bytes, of the operating system file at the time that the backup image was created.
Maximum size, in bytes, that the operating system file can attain.
When using the ReadFileList method, one of the Restore object device properties must indicate the device maintaining the backup media.
To use the ReadFileList method
Create a SQLServer object.
Connect the SQLServer object to an instance of SQL Server on which the source backup device is visible.
Create a Restore object.
Set either the Devices, Files, Pipes, or Tapes property to indicate a device visible on an instance of SQL Server indicated in Step 2 and maintaining the backup media. Specify only a single device or file.
If desired, set the FileNumber property to indicate a specific backup set by ordinal location on the media. By default, the database files of the first backup set are enumerated.
Call the ReadFileList method of the Restoreobject using the SQLServer object created in Step 1 as an argument.
When the media of a backup device is unused, such as when a disk device is empty, the ReadFileList method succeeds, returning an empty QueryResults object.