I’m having issues with the SelectedPath property of the FolderBrowserDialog when the folder I select is on a remote server and is a symbolic link (or any kind of reparse point).
If i select a normal folder, then I get the full path returned, for example “\SERVER\folder\subfolder\thing_I_clicked_on”.
However, if the folder is a reparse point, i get just “\SERVER\thing_I_clicked_on” (so it’s missing the full path)
var dialog = new FolderBrowserDialog();
dialog.ShowDialog();
MessageBox.Show(dialog.SelectedPath);
Anyone come across this or have any suggestions? It doesn’t appear to be permissions related, as if I know the full path i can quite happily browse to it, etc.
so, I’ve been investigating this quite a lot, and think i have an answer.
First, a bit of explanation about what I was seeing!
on server A, there is a share which contains a symbolic link to a share on server B:
and the target of that is
What was actually happening was, the value returned from
FolderBrowserDialog.SelectedPathwas\\serverB\Folder, and I was mistakenly thinking it was missing parts of the path, because the strings serverA and serverB are very similar! Sorry for misleading everyone.I created my own wrapper following this MSDN Example and noticed that the Shell32.dll function
SHGetPathFromIDListis returning the Target of the reparse point, despite the fact that the documentation saysI did notice that the path before that is the correct one though, so in my callback method when the status changed, I captured the untranslated selected path
So the
SelectedFullPathProperty contains\\serverA\Path\To\FolderandSelectedPathproperty contains\\ServerB\Folder, which leaves me a lot to work with.