Getting My documents folder path of current logged in user ( limited previlege) from an application which is launched with admin credentials.

  • Thread starter Thread starter DeepakHirapur
  • Start date Start date
D

DeepakHirapur

Guest
Please help me

To get the "MyDocuments" Path of current logged-in user .

The logged-in user doesn't belongs to administrator group.

i have tried below three case it is returning "C:\Users\Administrator\MyDocuments". when i run the application with run as administrator.

1 Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)

2) Path.Combine(Environment.ExpandEnvironmentVariables("%userprofile%"), "Documents")

3) "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Personal", RegistryHive.CurrentUser

But in the registry the "MyDocuments"path is different like "C:\Users\testAccount\Mydocuments". testAccount is logged-in user.

Continue reading...
 
Back
Top