Understanding Windows 7 Libraries

Written By The Ones on Saturday, May 16, 2009 | 4:23 AM

This post describes some of the rationale that drove Windows 7 Libraries functionality, and explores the new features and opportunities we, as developers, have with Windows 7 Libraries.
What Libraries mean for users in Windows 7?
To better understand the concept of Libraries in Windows 7, we need to look back to the time before Windows 7. Earlier version of Windows like Windows Vista and XP, included sets of special folders for storing user’s content such as “My Documents” and “My Pictures.” In Windows Vista, these special folders where automatically indexed to allow users to perform faster more efficient searches on their content. Even so, many users, me included, store their files, music, and pictures all over the PC in various folders like c:\temp, d:\Birthday2008\pictures, or even in remote storage. We refer to this as storing data outside the user’s profile storage space. This affects the indexing and therefore the entire search experience, and often sends the user on a small quest to try to find their content.
So, in Windows 7, Libraries tries to address the problem of users' content stored all over the PC by allowing users to have full control over their “Documents Library” folder structure. Meaning that in Windows 7, users can define which folders to include in the Documents Library. This is true for any Library. Therefore, we can say that Libraries are user-defined collections of content. By including folders in Libraries, the user is telling Windows where his important data is located. The system will index folders, to enable fast searching and stacking based on file properties.
In Windows 7, users will go to Libraries in order to manage their documents, music, pictures, and other files. As you can see in Windows Explorer and the Common File Dialog, Libraries are an integral part of the Windows Shell. This integration is very important because it enables users to browse their files the same way they would in a folder, which means there is no new behavior to learn. Clicking on the Documents Library shows you your documents. Moreover, due to the fact that libraries are integrated into the Windows Shell, users can perform searches and filter results by properties like date, type, and author in both Windows Explorer and the Common File Dialog. In other words, by using libraries, users get to enjoy storage that is both flexible and indexed. The following image displays the integration of several folders into a single library view and the rich search and pivots of Windows Explorer in Windows 7.

So what is a library?
In many ways, a Library is similar to a folder. As we mentioned before, when users open a Library, they can see one or more files or folders. However, unlike a folder, a Library can display files that are stored in several folders at the same time. This is a subtle, but important, difference. Libraries don't actually store items. They monitor folders that contain a user’s items, and provide a single access point and rich view pivots (by file Type, date or author) of this aggregated content. Libraries promote a user’s data and let the file system fade into the background.
The Windows 7 default Libraries setting has one main Library called “Libraries” that contains four predefined default Libraries: Documents, Music, Pictures, and Videos. Users can save and copy files directly to a library, even if we said that libraries are not file system folders, since every library has a default save location to send these files to. Each library contains two physical file locations, the user's personal folder (this is the default Known Folder that is included in a library, for example, My Documents in the Documents Library), and the public folder For custom categories, the default save location is the first folder added. Users may change the default save location of a library at any point, but if they remove the default save location, the system selects the next folder in the library as the new save location. In addition, users can save to any folder they have permissions to that are included in a library.
For folders to be successfully added to a library, they must be capable of being indexed on the local machine, indexed on a remote Windows machine, or on a server with files indexed by Windows Search. In order to maintain the high standards for the Windows Shell search experience, users can’t add folders that are not indexed into a folder.
What more do developers need to know about Libraries?
After understanding what Libraries are, developers need to understand how they can support and use Libraries in their applications. This is important because by using Libraries, users inform Windows where their important data is. This allows you, as developer, to access a user's Library and consume its contents, removing the need maintain your own set of data storage for your application.
You can also use the new IShellLibrary API to empower your applications to manipulate libraries. This can help ensure that applications remain in sync with user files and Windows since any change made to a library structure will be reflected in the application that is monitoring that library – giving us developers great power and great responsibility.


Post a Comment