Private Sub findPSTButton_Click(sender As Object, e As EventArgs) Handles findPSTButton.Click
BackupperProgress.Value = 0
For Each foundPST As String In My.Computer.FileSystem.GetFiles(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), Microsoft.VisualBasic.FileIO.SearchOption.SearchAllSubDirectories, "*.pst")
Catch ex As Exception
BackupperProgress.Value = 99
According to several sources, this should do the following:
a) Start the progress bar
b) Search the current logged in User Profile folder for PST files.
c) Ignore Junction Points (i.e. My Pictures under Documents, etc) and all exceptions
d) Add all of the PST's found to the ListBox
Unfortunately, when the button is clicked nothing appears in the list box. Can anyone tell me what I've done wrong here?
EDIT: By adding a MsgBox(ex.Message) I found out that I'm still getting access denied errors. I've tried putting a Catch line after the For Each one but it blocks the foundPST variable from being used elsewhere in the code. It also says that a Next line needs to be before the Catch. But if I do that I'm back to square one.