We want to take db backups programmatically. For this we used the SqlServer.Management.Smo namespace and its classes, and it is working perfectly.
Now we have a requirement to determine whether there is enough space is there in the location to hold the backup files before saving the db backup to the specified location.
And if there is not enough space, we want to alert the user of that fact.
One way we found is that put a try catch and catch the exception if there is no enough space in memory. But we are looking for a solution to get the size before saving it.