Is it possible to test for folder redirection in .net? I don't mean reparse points/junctions, I mean when a folder (usually My Documents) is redirected to a server.
In such cases, if you are traversing the folder system of a PC you'll encounter an IO error if you reach the local version of the folder. So it would be useful to be able to test for My Documents folder redirection, so as to be able to take action (skip the folder, jump onto the server etc).
I know I can get the location of My Documents (but only for the current user) using
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
but that doesn't help me test for it in advance across (potentially) multiple users.
Do I need to use something like SHGetKnownFolderPath?
Right-click a folder that you want to redirect (for example, Documents), and then select Properties. In the Properties dialog box, from the Setting box, select Basic - Redirect everyone's folder to the same location.
Folder Redirection allows saving data regardless of storage location and separates user data from profile data decreasing the time required to log on. Other advantages include: Data is stored on a server where it can be backed up.
Open User Configuration > Policies > Windows Settings > Folder Redirection. Right-click Documents and click Properties. Choose Basic - Redirect everyone's folder to the same location.
You could query the registry key:
http://support.microsoft.com/kb/221837
You can also query the group policy for redirection:
http://technet.microsoft.com/en-us/library/cc781907(WS.10).aspx
Once you have that value you can easly test for network/mapped drive, this is how I do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With