Windows File System Namespace Usage Guidelines
Windows File System Namespace Usage Guidelines
Anshul Rawat
Microsoft Corporation
June 2007
Applies to:
Windows Vista®
Summary: This white paper is intended for application developers and IT professionals.
It provides guidelines for using the Windows Vista User Profile namespace in your
applications. Windows Vista has an improved file system namespace that enables users
to find and organize data easily. The file system namespace also enables application
developers to distinguish between application-managed data and end-user-managed
data, between private data and shared data, and between computer-dependent data
and computer-independent data. The new file system namespace provides a platform
that leverages features already available in Windows (for example, folder redirection)
and improves the functionality of features in user scenarios (for example, improved data
roaming, data migration, and data backup).
Legal Notice
The information contained in this document represents the current view of Microsoft Corporation on the issues
discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the
accuracy of any information presented after the date of publication.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under
copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or
transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or
for any purpose, without the express written permission of Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights
covering subject matter in this document. Except as expressly provided in any written license agreement from
Microsoft, the furnishing of this document does not give you any license to these patents, trademarks,
copyrights, or other intellectual property.
Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses,
logos, people, places and events depicted herein are fictitious, and no association with any real company,
organization, product, domain name, e-mail address, logo, person, place or event is intended or should be
inferred.
Microsoft does not make any representation or warranty regarding specifications in this document or any
product or item developed based on these specifications. Microsoft disclaims all express and implied
warranties, including but not limited to the implied warranties or merchantability, fitness for a particular
purpose and freedom from infringement. Without limiting the generality of the foregoing, Microsoft does not
make any warranty of any kind that any item developed based on these specifications, or any portion of a
specification, will not infringe any copyright, patent, trade secret or other intellectual property right of any
person or entity in any country. It is your responsibility to seek licenses for such intellectual property rights
where appropriate. Microsoft shall not be liable for any damages arising out of or in connection with the use of
these specifications, including liability for lost profit, business interruption, or any other damages whatsoever.
Some states do not allow the exclusion or limitation of liability or consequential or incidental damages; the
above limitation may not apply to you.
Microsoft, MS-DOS, Windows, Windows Media, Windows NT, Windows Server, Windows Vista, Active
Directory, ActiveSync, ActiveX, Direct3D, DirectDraw, DirectInput, DirectMusic, DirectPlay, DirectShow,
DirectSound, DirectX, Expression, FrontPage, HighMAT, Internet Explorer, JScript, Microsoft Press, MSN,
NetShow, Outlook, PlaysForSure logo, PowerPoint, SideShow, Visual Basic, Visual C++, Visual InterDev, Visual
J++, Visual Studio, WebTV, Win32, and Win32s are either registered trademarks or trademarks of Microsoft
Corporation in the U.S.A. and/or other countries.
The names of actual companies and products mentioned herein may be the trademarks of their respective
owners.
Contents
Introduction
Windows Vista® defines a User Profile namespace, which is a namespace of folders that end users and
applications use for storing files. The structure of this namespace is intended to enable end users,
applications, administrators, and the operating system to best use the storage features offered by the file
system. To decide where files should be stored, you must consider several issues.
In addition to the root location, the names and locations of individual subfolders in the User Profile have
also changed in Windows Vista. Previous versions of user profiles contained a complex folder structure,
often nesting folders two to three layers deep. The new folder locations contain fewer nested folders,
simplifying navigation, and the new names are reflective of the data contained within them. The following
table displays the names of the folders in both Windows Vista and Windows XP. Additionally, the table
shows the Windows XP folder locations. (In Windows Vista, all these folders are at Users\%username%\.)
The Application Data folder structure, which is used by applications to store per-user application data, has
changed in Windows Vista. Previous user profiles did not logically sort data stored in the Application Data
folder, making it difficult to distinguish data that belonged to the computer from data that belonged to the
user. Windows Vista addresses this issue by creating a single AppData folder under the Users profile
(Users\%username%\AppData) which contains three subfolders: Roaming, Local, and LocalLow.
Windows Vista uses the Local and LocalLow folders for application data that should not roam with the
user when they log onto another computer. Usually, this data is either computer-specific or too large to
roam. The AppData\Local folder in Windows Vista is the same as the Documents and
Settings\%username%\Local Settings\Application Data folder in Windows XP.
Windows Vista uses the Roaming folder for application-specific data, such as custom dictionaries, which
are computer-independent and should roam with the user profile. The AppData\Roaming folder in
Windows Vista is the same as the Documents and Settings\%username%\Application Data folder in
Windows XP.
…\AppData\Roaming\Microsoft\Windows\Network Nethood
Shortcuts
…\AppData\Roaming\Microsoft\Windows\Printer PrintHood
Shortcuts
…\AppData\Roaming\Microsoft\Windows\Recent Recent
…\AppData\Roaming\Microsoft\Windows\Send To SendTo
…\AppData\Roaming\Microsoft\Windows\Templat Templates
es
…\Desktop Desktop
…\Documents My Documents
…\Favorites Favorites
…\Music My Music
…\Videos My Videos
…\Pictures My Pictures
…\Desktop Desktop
…\Documents My Documents
…\Favorites Favorites
…\Music My Music
…\Videos My Videos
…\Pictures My Pictures
Windows Vista shared application data location Windows XP shared application data location
For example, adding a shortcut to the desktop of the All Users profile resulted in every user receiving the
shortcut on their desktop when they logged on.
In Windows Vista®, the All Users profile is renamed Public and has a folder structure similar to all other
Windows Vista profiles except for the Public AppData folder.
Note The All Users\Application Data portion of the All Users profile in Windows XP, which provided a
location for applications to store shared application data common to all users, has also been moved in
Windows Vista. It is now located at the root of the system drive as a hidden peer of the Program Files and
the Users folders. This is the location where all shared application data should be stored across all user
accounts.
Windows Explorer will continue to merge specific folders in the Public profile (such as the Desktop and
Start Menu folders) with regular user profiles at logon. As in Windows XP, the Public profile does not have
a user registry because Windows does not load this profile. Therefore, Windows writes all shared settings
to the HKEY_LOCAL_MACHINE hive of the registry.
Program Files Program Files Default Location for Shared Application files and
binaries
ProgramData Documents and Settings\All Default Location for Shared Application data and
Users\Application Data settings
Users Document and Settings Default location for all User Account profiles
Users\Public Documents and Settings\All Default location for user data shared between all
Users users
Users\%username% Documents and Default location for each user's individual profile
Settings\%username%
Visible folders in the user’s profile and the public profile exist to store end-user-managed data.
C:\Users\<username>\<ContentType> (for example, C:\Users\<username>\Documents)
Application-managed data, which, typically, a user never interacts with directly (for example, Microsoft
Office Word toolbar settings), should go in folders that are less visible in the UI. These folders are hidden
and placed in locations that users normally do not encounter. There are per-user and public forms of
these folders as well as roaming, local, and low-rights forms.
C:\Users\<username>\AppData (hidden)
C:\ProgramData (hidden)
Because it is common for certain types of files to be end-user managed and application managed,
consider the following characteristics for each of these types of data and select the most appropriate
storage location for these files.
Users do not rename the files or the folders managed by the application because it might interfere
with the correct operation of the application.
The application provides the majority of the management functions for the data (backup, copy,
delete).
The application provides access to the storage location of the data, for example, an Open File
command that helps users find the data.
Storing this data with end-user-managed data would clutter that space, making users less efficient or
annoyed by its presence because it is not “theirs”.
Outlook® PST files. Outlook offers a management UI for these files that handles the rare case when
users must perform management tasks on the data.
Windows registry (NTUSER.DAT)
Temp/cache files and Temporary Internet Files
Application settings stored in files like .ini files or databases
Log files
Note The Sharing feature in Windows Vista also enables a user to share access to files and folders
stored within a profile. The user can choose to share an individual file or an entire folder within their user
profile without moving it to the public folder. When a file or a folder is shared to a user, only that file or that
folder is shared while the rest of the profile is still secure. This functionality enables the user to control
which users access specific shared data.
C:\Program Files:
o Storage location for programs and software components.
o Users should not store any user data or application data here because of the security
permissions configured for this folder. Standard users do not have rights to write data to
this location.
C:\ProgramData:
o Storage location for application data that is to be shared between all users on that
computer.
C:\Users\<username>\AppData:
o Storage location for per-user application data that is exclusive to a user and should not
be shared with any other user on that computer.
o The AppData location itself has a further hierarchy below it to differentiate computer-
dependent application data from computer-independent application data. This hierarchy
is discussed in detail in the next section.
1. Determine the type of application data you are storing in the file system. Is it computer-
dependent, computer-independent, or low-rights integrity data?
Based on that information, use one of the following paths to store the data:
• C:\Users\<username>\Appdata\Roaming
• C:\Users\<username>\Appdata\Local
2. Create a subfolder under the appropriate AppData folder above using the following convention:
Folder redirection. You can relocate a folder from within the user's profile to another hard disk
location or to a network location. For example, if you run out of disk space, you can redirect your
Pictures folder to D:\Pictures, D being a hard disk drive that has the storage capacity you need.
Search scopes. You can search in a specific folder or set of folders. Indexer crawl scopes are
based on a set of folders and on rules that can be applied to items in those folders.
Security permissions. These are typically applied using inheritance. This enables the items in the
folder to set their security based on the security configuration of the folder.
File sharing. This enables users to share a specific folder and the files within that folder.
File syncing features. You can synchronize files stored in multiple locations. For example: through
Foldershare.com™ and Microsoft® Office Groove™.
Folder UI customization. This includes view modes (thumbnails versus details), visible columns,
command, and pane visibility. For example, custom templates can be applied to folders for
storing music and pictures to create a better experience with the items within those folders.
To enable such features, application developers should make an effort to reuse the existing folder
structure provided by Windows Vista where possible. If you cannot use the existing defined structure and
need to extend it with your own folders, you should:
Extend the folder structure in a manner that matches the user’s need for the data that will be
stored in them, as defined in earlier sections (user-managed data vs. application-managed data
or per-user data vs. public data).
Take into account the relevant features of both Windows Vista and the application that might be
applicable to that data as defined in earlier sections of this document.
The following sections contain detailed guidelines for using the namespace and descriptions of ways to
extend it.
For document files, like .docx, .pps, .xls, and .txt files, you should use the Documents folder.
For music files, like .mp3, .wma, and .rp, you should use the Music folder.
For video files, like .wmv, .mov, .mpg, and .avi, you should use the Videos folder.
To store a new data type that does not map to any of the existing folders in a user's profile, applications
should create a new data folder either at the root of the user's profile (for example,
C:\Users\<username>\<new datatype>) or at the root of the Public profile (for example,
C:\Users\Public\<new datatype>) The choice of location will depend on whether the data is per-user data
or should be shared among all users on the computer. This will also ensure that it is a peer of other data
folders like Documents and easily discoverable and accessible by the user.
Applications should use the extensible Known Folder system to define their folder as a well known
Windows folder to enable features like redirection or to enable other applications to find that folder. For
more details on the Known Folder mechanism, please see the Known Folder API documentation on
MSDN at .
Application creators should publish a specification that explains the intended use of their folder and
publish the KNOWNFOLDERID in a Software Development Kit (SDK) to enable other applications to
access it programmatically if appropriate.
When reviewing all the data your application creates, you should have a clear separation between user-
managed data and application-managed data. Applications should not create application-managed files in
the profile root as that can cause unnecessary clutter. This type of data should be stored below the
AppData folder within the user’s profile as described earlier.
To avoid cluttering the user namespace, applications should not encourage the creation of user-managed
files in the root of the user's profile folder (C:\Users\<username>). They should encourage storing the
data within the subfolders as mentioned earlier. There are group policies in Windows Vista that can
prevent the user from creating items at the root of the user profile in Windows Explorer and your
application might break if you encourage that behavior.
An application can enable relocation of folders it manages by using the Folder Redirection feature in the
Windows® operating system. This enables the end user to make the decision to relocate that data if they
want to, such as to the root of the disk, to another local disk, or to a network location. Folder redirection
was part of Windows 2000 and Windows XP, but was limited to only the My Documents, My Pictures,
Desktop, Application Data, and Start Menu folders. Windows Vista allows a larger selection of known
folders to be redirected. Applications can also enable a custom folder to be redirected in their folder
definition when they create the folder using the Known Folder APIs as described on MSDN at
http://msdn2.microsoft.com/en-us/library/ms645247.aspx.
To see a list of all well known locations that can be accessed using the Known Folder system, review the
KNOWNFOLDERID topic on MSDN at http://msdn2.microsoft.com/en-us/library/bb407328.aspx.
Important An application should never try to hard code or save an absolute path to a well known
Windows location or to files stored within. The path to the data can change over time due to features like
folder redirection or may vary from one computer to another. As a result, the application might break or its
data might become inaccessible. Using the Known Folder APIs ensures that you are always able to get to
your data.
If, for some reason, you are unable to use the APIs to get programmatic access to a folder, you can use
predefined environment variables in Windows to build a relative path to the data you are accessing. The
following is a list of variables and the default locations they point to, which you can use to build a relative
path:
To programmatically access all Windows Vista well known folder locations, including well known folders
that your application created, use the SHGetKnownFolderPath function.
You can use the SHGetFolderPath function if all of the following are true:
You are building an application that must work on both Windows Vista and Windows XP.
You do not need to define a new data folder type for your application.
To store data that is accessible on both Windows Vista and Windows XP, you are using only the
well known folder locations that are supported on Windows XP.