0

Is it possible in C# to find the application data folder path for all other Windows users except the logged-in user? I have checked various options like SID value path in Registry, System.DirectoryServices but none of them seems to work as expected.

I also tried appending/replacing the username in the folder path using WMI code, but in some cases it fails as in those special cases the username is not the same as available in the folder path.

Please note that, there are no issues accessing current user application data folder. I need to find out the path for all the users (there is a difference between "all the users" and "all users") account currently available on that particular system (admin privilege).

Please suggest a solid way to retrieve this information. Thanks in advance for not marking it as duplicate, because the question is bit different than the other questions.

Community
  • 1
  • 1
  • 1
    Youve actually linked to a question which is as near to perfect duplicate as far as I can see What makes you think this question is different? – Jamiec Jul 19 '16 at 07:31
  • 1
    _there is a difference between "all the users" and "all users"_ — So what _is_ the actual difference? – Uwe Keim Jul 19 '16 at 07:32
  • 1. None of the linked forum posts worked for me and I don't have enough points to comment there. 2. Here by using "all users", I meant to say "C:\Users\All Users". But I want to know the path for all the users available in that system. – Kunal Chowdhury Jul 19 '16 at 07:36
  • 1
    Just saying "That didnt work - give me another answer" is not the way it works. *Why* didnt it work for you? *What* behaviour did you get which you didnt expect? – Jamiec Jul 19 '16 at 07:37
  • First of all, the SID path in Registry is only applicable for currently logged-in users. When a user logs off, the entry disappears from registry. Second, for the WMI and DirectoryService, it doesn't work all the times. For example, when I create an account "test" and assign a name "test user" in user accounts, the path looks as "C:\Users\test" but WMI/DirectoryService returns "test user" instead of "test". Hope this clears all the doubts. – Kunal Chowdhury Jul 19 '16 at 07:43
  • This http://stackoverflow.com/questions/16865482/accessing-file-information-for-all-users-c-sharp ? It suggests that you can just list all of the folder names under \User and add \AppData – kurakura88 Jul 19 '16 at 07:45
  • No, it will have a problem when executed in Win XP. Also, the admin can relocate to a different path using the unintended installation. In that case, that will not work. Please suggest a dynamic way to retrieve the said informations/paths. – Kunal Chowdhury Jul 19 '16 at 08:54

0 Answers0