none
Cannot modify file under "All Users" folder in windows 7 using C# programming RRS feed

  • Question

  • Hi,

    Here is my scenario,

    I have an Outlook add-in which, I am writing some information into a common file through this Add-In. When I created a installable, I kept common file under "All Users"(Common Application Data Folder) folder. When I install this add-in on XP it is working perfectly fine and no issue of permission.

    Now, when i move this application to Windows 7, I am getting some file access permission exception. With reference to some blogs, I have added application specific folder under "All Users." After this also I am unable to write into this file.

    Is there anything else that I need to do, by which I will able to write into this file.

    I have read some blogs about UAC, however, I didn't get clear picture of its use for Add-in.

    I appreciate your help.

    -Avinash

    Sunday, December 4, 2011 6:41 AM

All replies

  • Even in XP, your application will only work when the user is an administrator.

    Your best bet is to place the file in a subfolder of Environment.SpecialFolder.CommonApplicationData (CSIDL_COMMON_APPDATA in Win32) when your application installs. If you need the file to be writable at runtime, you will need to set the permissions on your subdirectory to allow the correct users (or all users, if that's what you need) to write to your subdirectory. By default, it will be read-only.


    Check out My Blog for tech news, development tips, and other information for geeks like me.
    Tuesday, December 6, 2011 2:47 PM