A shortcut to it is displayed directly on the user's desktop. The Windows NT family of operating systems set up the "My Documents" folder in the user's profile folder. In Windows XP and earlier, the path is \Documents and Settings\[user name]\My Documents\ (alias %USERPROFILE%\My Documents\ ) on boot volume.
The default paths are: Documents: %USERPROFILE%\Documents. Music: %USERPROFILE%\Music. Pictures: %USERPROFILE%\Pictures.
I'm developing a C# WinForms application. This application has the ability to update if an update is available on server. It's working fine, but only for an admin user.
The Application will check and apply update with the steps below if user doesn't have admin privileges:
Problem
After an applied update (only for normal user) the application is running as an admin user and I'm trying to get the Documents folder path of current user. It gives me the Documents folder path of the admin user because of application is currently running as the admin user, but I want the Documents folder path of currently logged on user.
Question
How can I get the current logged on user's Documents folder if the application is running as an admin user?
Currently I am get Document folder path with below code.
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
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