none
Shared User Data Location

    问题

  • What is Microsoft's recommended folder location for sharing files among users (so all have the ability to create, modify, and save files)?

    There seems to be two possible places:
     * CommonAppData => C:\Program Data\[company]\[App Name]\
     * Public=> C:\Users\Public\

    The problem with [CommonAppData] is that it is a hidden folder so it is not a user-friendly path.  The files that will be stored are intended to be browsed, opened, and saved, by all users.  Also, does it break Vista's guidelines to have a shared folder with full control granted to everyone in the C:\ProgramData folder? 

    [Public] seems like a good place but I haven't found much documentation on its intended use.  Also, using Install Shield, [Public] is not a defined location, so perhaps [Public] is not intended to be used by other apps?

    Is there a location that would be better than either of these?

    I need a solution that meets the "Certified for Windows Vista" requirements so citing any MS documentation related to this issue would be greatly appreciated.  I have found suggestions from various places but I would like Microsoft's official recommendation.

    Thanks,
    Ben

    2007年1月16日 18:11

全部回复

  • I suspect that a common location for user-editable data files might be:

    \Documents and Settings\All Users\Shared Documents

    ... in Windows XP, which I read as corresponding to Windows Vista's:

    \ProgramData\Documents

    -which points to-

    \Users\Public\Documents

     

    To get to this directory path in Windows XP I have been able to use the "scriptable" Microsoft Shell Controls and Automation library (exposed by Shell32.dll) in VB/VBA/VBScript using the Special Folder constant:

    ssfCOMMONDOCUMENTS = &H2E

    This value is not available as a member of ShellSpecialFolderConstants in the version of Shell32.dll in WinXP SP2 is is not documented as a legal value in the Platform SDK.  However the SDK's include file ShFolder.h does have:

    #define CSIDL_COMMON_DOCUMENTS 0x002e // All Users\Documents

    This led me to try defining ssfCOMMONDOCUMENTS and using it with the Shell Object's NameSpace() method, and it is functional and seems completely stable under WinXP SP2.  I have no reason to think things would be different for SHGetSpecialFolderPath calls with this constant.

     

    On Windows XP this location appears to the user as:

    Shared Documents

    ... and while I haven't had the opportunity to test it on Windows Vista I'd assume the user's view of this location would have a similar friendly name.

     

    As I said I haven't been able to test on Vista yet.  However I should make it clear that it does not work on Windows 2003 Server in my testing.  Calling Shell.NameSpace(ssfCOMMONDOCUMENTS) results in a failure on Win2003 SP1 even though it works fine on XP SP2.  I can't determine whether this is a Win2003 flaw, part of some security lockdown remedy applied in Win2003, or a failure on my part in using an undocumented value.

    For this reason I hesitate to recommend the use of this value for Vista until somebody has confirmed it.

    I suspect that ssfCOMMONDOCUMENTS (0x2E) may have the alias ssfPUBLIC as well.  I say this because the value ssfPERSONAL (CSIDL_PERSONAL or value 0x5) corresponds to:

    \Documents and Settings\<user>\My Documents

    ... on Windows XP.  However this is merely a guess and in any case the actual value is what is important.

     

    I have not found any Special Folders constant that would get you to the level above this, i.e.:

    \Users\Public

    ... in Windows Vista, also known in Windows XP (?) as:

    \Documents and Settings\All Users\

    2007年1月18日 8:05
  • Ben-

    Did you find Bob's recommendation workable on Vista?  We have been investigating the same issue and came to the same conclusion and dilemma you did.

    Thanks.

    -Anne

    2007年4月9日 20:46
  •  Ben Corneau wrote:

    What is Microsoft's recommended folder location for sharing files among users (so all have the ability to create, modify, and save files)?

    There seems to be two possible places:
     * CommonAppData => C:\Program Data\[company]\[App Name]\
     * Public=> C:\Users\Public\

     

    CommonAppData is the location to use for files and configuration information that end users are not expected to modify directly. As a rule of thumb, if it is critical that the information be shared between multiple users it should go there and you should present suitable UI in you app to make changes, the user should never be expected to go hunting in hidden folders.

     

     The Public documents folder is intended for user created files that they wish to share. Generally you shouldn't be automatically creating files/folders there (much as you shouldn't in the user's documents folder), it should be the users decision where they save files. Files stored here should be assumed to be documents that users may manipulate in various ways (email, moving, renaming, copying, deleting etc) without affecting the stability of you application.


     Ben Corneau wrote:

    The problem with [CommonAppData] is that it is a hidden folder so it is not a user-friendly path.  The files that will be stored are intended to be browsed, opened, and saved, by all users.  Also, does it break Vista's guidelines to have a shared folder with full control granted to everyone in the C:\ProgramData folder? 

    If you create a subdirectory for your application then you may change the permissions as required on it whilst still being Logo compliant. However I strongly recommend that you do not grant Everyone Full Control. To minimize security and stability issues you should at most grant the built in Users group Modify permissions (i.e. Read/Write only)

    • 已建议为答案 kewsvnet 2011年2月25日 10:55
    2007年4月10日 10:00