0

Environment: Windows PC running .NET Framework.
Sample code:

Console.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.Personal)  
Console.Readline()

On my PC, this results in c:\Users\mds\Documents. Doing an echo %USERPROFILE% at the command line yields c:\Users\mds.

My customer's environment is more complicated, involving redirection and roaming profiles. The above code shows \\someserver\users\theiruser. Doing an echo %USERPROFILE% shows c:\Users\theiruser.

Theiruser was migrated to the server \\anotherserver, but the above code still shows \\someserver\users\theiruser. They allege it should either come back with \\anotherserver\users\theiruser, or c:\Users\theiruser\Documents.

Am I executing the wrong code to obtain the Personal (or MyDocuments) folder, or have they configured something wrong (and if so, what)?

Matt Smith
  • 626
  • 6
  • 15
  • This is entirely in control of the user's IT staff, nothing you can do about it. They should ask a question about it at serverfault.com – Hans Passant Oct 19 '16 at 20:24
  • `Environment.GetFolderPath` internally uses the shell32.dll function `SHGetFolderPath` - which is the proper function to use. So I would lean towards a misconfigured environment. – Sam Axe Oct 19 '16 at 20:28

0 Answers0