views:

506

answers:

1

When I select Document folder of other users by folderBrowserDialog.SelectedPath it retrives the path like "C:\Documents and Settings\Ahammed**My Documents**"

but it should not be like that , it should retrive as "C:\Documents and Settings\Ahammed\Ahammed's Documents".. Guys anyone can help me on this ...to retrive the correct path through folderBrowserDialog.

Requirement is to extract the correct name of the folder "Ahammed's Documents" through folderBrowserDialog() ...

+1  A: 

I think that actual path is: C:\Documents and Settings\Ahammed\My Documents.

C:\Documents and Settings\Ahammed\Ahammed's Documents seems to be improvisation by OS to show nice labels.

Once you get path in User's home folder you can use this to format it according to your needs:

 if (fbd.ShowDialog() == DialogResult.OK)
 {
    string path=fbd.SelectedPath;
    path = path.Substring(0, path.LastIndexOf("\\"));
    path += @"\" + path.Substring(path.LastIndexOf("\\")) + "'s Documents";
 }
TheVillageIdiot
Hi AMAN, Actually here I need to extract the correct name of the folder "Ahammed's Documents" ... – Anees 2 mins ago
Andy
The path returned certainly is the acutal path. Something like "Ahammed's Documents" is just a display name that the Windows Explorer creates on the fly. If you need this display name you have to build it yourself (the pattern is quite clear). I am not aware of an API doing this for you...
Stefan Egli
sorry to say, this isn't i needd..you are right ,it works for special case not for other.
Andy
Yes @Anees you have to also keep track when user select some one other's (or own) documents folder.
TheVillageIdiot