tags:

views:

102

answers:

1

I am able to use SMO to build a treeview similar to the Locate Backup File dialog from SSMS. I can list folders on the server, and if there are backup devices, those will be listed as well. One thing I can't seem to duplicate is how to browse for a backup file to restore that was not originally backed up from the server (so it's not in the list of backup devices).

I'm looking for something like this screenshot of the SSMS dialog: SSMS Locate Backup File Dialog

Is there an EnumServerFiles method similar to the Server.EnumDirectories() method?

Keep in mind, this may be running against a SQL Server that isn't the local machine (a network server).

+2  A: 

Don't try using SMO for this, just use a regular file system browse dialog.

Edit: For a remote system, get the info you want with:

 exec xp_dirtree 'c:\sqlbackups\', 1, 1
Rob Farley
@Rob Farley: What if it's on a server other than the local machine?
C-Pound Guru
Ah, I see your point. Try using: xp_dirtree 'C:\sqlbackups\', 1, 1
Rob Farley
@Rob-Farley: Edit your answer with xp_dirtree and I'll accept your answer. Thanks!
C-Pound Guru