I found out that my question was wrong for my purpose due to permission material. The solution I found is written here at stackoverflow.com, and I mixed it up with the following code in my application to get the address of public documents.
private static string getAddress() { RegistryKey rk = Registry.LocalMachine; RegistryKey sk = rk.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\explorer\\Shell Folders"); string address = ""; if (sk != null) { address = (string)sk.GetValue("Common Documents", @"c:\Users\Public\Documents"); } return address; }
Let's look at what I said and what I did. At first I found out that what I want is wrong, and the ApplicationData folder is accessible only to this creator, while I need a folder that is used by all users. So I found the link and followed it, creating the folder that I wanted in FileSystem Explorer in my installer project. Then I changed my code to C # and made it read the address from the registry.
source share