views:

669

answers:

2

Our Windows Forms application by default saves data files in a user's 'My Documents' folder (on XP) or 'Documents' folder (on Vista). We look up this location by calling:

Environment.GetFolderPath( Environment.SpecialFolder.Personal )

We know for sure this works great for users whose personal folder is on a local disk. What we're not sure about is domain users who have Folder Redirection in effect for their profile/personal data folders.

My question is: Does the above call properly resolve regardless of whether Folder Redirection is active?

I don't have the environment to test this out, and I haven't been able to find any definite confirmation one way or the other.

+1  A: 

I would expect that it does. The documentation for both Environment.GetFolderPath and the underlying SHGetSpecialFolderPath don't give any indication that it would not resolve correctly nor can I find anything that you would use its place.

Jon Norton
+1  A: 

Yes it does. You can test this out yourself by updating the corresponding registry entry for the folder. Look under ...

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

JaredPar
I know that changing the target of the 'My Documents' folder will update this registry key (and, consequently, the Environment.SpecialFolder' call will work correctly).But does Folder Redirection work in the same way?
CBono
Yes. It essentially updates this value.
JaredPar