Understanding Windows 7 Libraries

This is the second post in a series of posts about Windows 7 Libraries. 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.

Win7_libraries

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.

In the next post, we will cover the underlying architecture of libraries and dive deeper into the API.


Comments

  1. Posted on: November 02, 2009 at 2:43AM  

    This library thing is stupid thing made by stupid people!

    Smart people made comlex things simple, and stupid people made simple thing complex.

    So Windows developers are very stupis people.

    If I save something to temp folder, I plan to delete it later, and I do not want this folder content to be in any folder with documents ot other important to me stuff.

    I cannot understand who will decide what folder in what library to add, because if this will be user, the same user that now store files in different locations, this is absolutely useless.

    If windows developer want to do something good, then they work on loading subtitles in windows media player, or to make weather gadget to work and for othr countries axcept for USA!!!

    Thear MS windows developers, there are other countries, and languages except USA, and english!!!

    Or maybe better make HDD to switsh off for more than 1 sec, then it is set to be turned off from power settings

    If I want to backup few folders I do not need your librries to make my life hard! If I can't find some software to do it for me I can write simple BAT file that will copy all folders I want, where I want, and all will be simple and clear

    So as I said, this library thing is most stuped thing ever made.

    In addition, there is no documentation, and I cannot find any info, what is passed to pidlFolder in initialize method of IShellExtInit Interface, so my shell extension is not working on libraries

  2. Posted on: November 02, 2009 at 4:02PM  

    Ventsislav Alexandriyski , thank you for your feedback! It's much appreciated. However, I would like to ask that in the future you perhaps be a bit more constructive. Name calling isn't a good way to get folks to listen to your feedback ;-)

  3. Posted on: November 03, 2009 at 3:10PM  

    Brandon LeBlanc, your appeal must be directed to MS developers developed Libraries, because in this idea there is not any constructive thing.

    Libraries are confizing for users, and make life of programmers hard.

    There are not any benefit from this libraries, just problems and complexity

    Now my super duper smart copy tool "Talent Copy" is not working on libraries, because SHGetPathFromIDList fails on value returned by pidlFolder, and there is not any explanation on MSDN why this happen and that exactly contain pidlFolder

    I understand that someone is got good money for developing of stupid idea of libraries, but this are wasted money

  4. Posted on: November 06, 2009 at 12:23PM  

    To - Ventsislav Alexandriyski

    I had to ask for help on this one, altough the answer is rather simple:

    SHGetPathFromIDList fails because it can only return filesystem paths for shell items that are marked SFGAO_FILESYSTEM, and libraries are not filesystem items (similar to the "computer" item) - that is they are not real files with real paths!

    You can use the shell namespace to reason over the library contents (msdn.microsoft.com/.../cc144090(VS.85).aspx) or use IShellLibrary if you want to do library-specific actions on the set of library locations.

    Hope this help,

  5. Posted on: November 21, 2009 at 5:19PM  

    Dear Yochay Kiriaty,

    After a lot of searches in MSDN documentation, and a few tests I found this simple solution to my problem:

    First I use SHGetNameFromIDList with SIGDN_DESKTOPABSOLUTEPARSING flag,

    next I initialize library inteface with SHLoadLibraryFromParsingName function, next I use GetDefaultSaveFolder method of IShellLibrary interface to get default save path object, and finally I use GetDisplayName method of IShellItem interface with SIGDN_FILESYSPATH parameter to get file system path, that I can pass to my copy algorithm

    Now things looks simple, but MSDN documentation does not give solution because it is not updated with new features

  6. Posted on: November 21, 2009 at 5:34PM  

    I forget to specify that I use this technique in shell extension of my copy tool talent copy, so it is tested and works

  • Page:
  • 1
  • 2
  • 3

Trackbacks

  1. Posted by: Windows 7 for Developers on April 06, 2009 at 7:38PM

    Libraries are the primary entry points to user data in Windows 7. They are the natural evolution from

  2. Posted by: Windows 7 Libraries .NET Sample Library ??? an Overview | Windows Seven 7 on April 06, 2009 at 8:19PM

    Pingback from  Windows 7 Libraries .NET Sample Library ??? an Overview | Windows Seven 7

  3. Posted by: Understanding Windows 7 Libraries - Windows 7 for Developers - The … | Current Technology Updates daily on April 06, 2009 at 9:27PM

    Pingback from  Understanding Windows 7 Libraries - Windows 7 for Developers - The … | Current Technology Updates daily

  4. Posted by: Understanding Windows 7 Libraries - Windows 7 for Developers - The … | networking-the.info on April 06, 2009 at 10:41PM

    Pingback from  Understanding Windows 7 Libraries - Windows 7 for Developers - The … | networking-the.info

  5. Posted by: Tech News, Resources from Blogosphere - 07 April 09(6) | Best Webhosting on April 06, 2009 at 10:47PM

    Pingback from  Tech News, Resources from Blogosphere - 07 April 09(6) | Best Webhosting

  6. Posted by: Tech News, Resources from Blogosphere - 07 April 09(6) | HintPoint on April 06, 2009 at 11:36PM

    Pingback from  Tech News, Resources from Blogosphere - 07 April 09(6) | HintPoint

  7. Posted by: Understanding Windows 7 Libraries - Windows 7 for Developers - The … | www.windows7vista.com on April 07, 2009 at 1:33AM

    Pingback from  Understanding Windows 7 Libraries - Windows 7 for Developers - The … | www.windows7vista.com

  8. Posted by: Windows 7 Libraries - Overview on April 07, 2009 at 3:29AM

    Pingback from  Windows 7 Libraries - Overview

  9. Posted by: Windows 7 Libraries | Windows 7 News on April 07, 2009 at 5:01AM

    Pingback from  Windows 7 Libraries | Windows 7 News

  10. Posted by: Understanding Windows 7 Libraries « zK++ Blogosphere on April 07, 2009 at 5:41AM

    Pingback from  Understanding Windows 7 Libraries « zK++ Blogosphere

  11. Posted by: Dew Drop - April 7, 2009 | Alvin Ashcraft's Morning Dew on April 07, 2009 at 7:30AM

    Pingback from  Dew Drop - April 7, 2009 | Alvin Ashcraft's Morning Dew

  12. Posted by: You Get The . Info » Windows 7 Libraries .NET Sample Library ??? an Overview - 22th Edition on April 07, 2009 at 8:17AM

    Pingback from  You Get The . Info » Windows 7 Libraries .NET Sample Library ??? an Overview - 22th Edition

  13. Posted by: Understanding Windows 7 Libraries|Join Our Story!|AngNetwork Blog on April 07, 2009 at 2:35PM

    Pingback from  Understanding Windows 7 Libraries|Join Our Story!|AngNetwork Blog

  14. Posted by: Les Actualites » Windows 7 Libraries on April 07, 2009 at 3:17PM

    Pingback from  Les Actualites  » Windows 7 Libraries

  15. Posted by: Windows 7 Libraries .NET Sample Library ??? an Overview | Windows 7 Information, News, Downloads, Support Forums on April 07, 2009 at 4:03PM

    Pingback from  Windows 7 Libraries .NET Sample Library ??? an Overview | Windows 7 Information, News, Downloads, Support Forums

  16. Posted by: Windows 7 Libraries on April 08, 2009 at 11:56AM

    Pingback from  Windows 7 Libraries

  17. Posted by: Windows 7 Library feature : Understanding and Use - Windows 7 on April 09, 2009 at 10:15PM

    Pingback from  Windows 7 Library feature : Understanding and Use - Windows 7

  18. Posted by: Windows 7 Libraries explained | win7connect - A website dedicated to Microsoft Windows 7 on April 12, 2009 at 3:01PM

    Pingback from  Windows 7 Libraries explained | win7connect - A website dedicated to Microsoft Windows 7

  19. Posted by: RSS Weekly Digest - #2 on April 14, 2009 at 6:59AM

    Pingback from  RSS Weekly Digest - #2

  20. Posted by: RSS Weekly Digest - #2 on April 14, 2009 at 6:59AM

    Pingback from  RSS Weekly Digest - #2

  21. Posted by: Windows 7 for Developers on April 14, 2009 at 1:38PM

    By now, you should have a better understanding of what Windows 7 libraries represent and how they can

  22. Posted by: Libraries Under the Hood | Windows Seven 7 on April 14, 2009 at 2:25PM

    Pingback from  Libraries Under the Hood | Windows Seven 7

  23. Posted by: Links for April 14, 2009 « Steve Mullen’s Blog on April 14, 2009 at 3:35PM

    Pingback from  Links for April 14, 2009 « Steve Mullen’s Blog

  24. Posted by: linkfeedr » Blog Archive » Libraries Under the Hood - RSS Indexer (beta) on April 14, 2009 at 4:08PM

    Pingback from  linkfeedr » Blog Archive » Libraries Under the Hood - RSS Indexer (beta)

  25. Posted by: Understanding Windows 7 Libraries « Central Blogosphere on April 14, 2009 at 6:50PM

    Pingback from  Understanding Windows 7 Libraries « Central Blogosphere

  26. Posted by: Libraries Under the Hood | Windows 7 Information, News, Downloads, Support Forums on April 15, 2009 at 8:32AM

    Pingback from  Libraries Under the Hood | Windows 7 Information, News, Downloads, Support Forums

  27. Posted by: linkfeedr » Blog Archive » Light Up with Windows 7 Libraries - RSS Indexer (beta) on April 16, 2009 at 6:07PM

    Pingback from  linkfeedr  » Blog Archive   » Light Up with Windows 7 Libraries - RSS Indexer (beta)

  28. Posted by: Light Up with Windows 7 Libraries | Windows Seven 7 on April 16, 2009 at 6:12PM

    Pingback from  Light Up with Windows 7 Libraries | Windows Seven 7

  29. Posted by: Light Up with Windows 7 Libraries | Windows Seven 7 on April 16, 2009 at 6:12PM

    Pingback from  Light Up with Windows 7 Libraries | Windows Seven 7

  30. Posted by: Windows 7 Troubleshooting Packs « On-Site Computer Services, Inc. in New Orleans Blog 504-469-6991 on April 17, 2009 at 8:44AM

    Pingback from  Windows 7 Troubleshooting Packs « On-Site Computer Services, Inc. in New Orleans Blog 504-469-6991

  31. Posted by: Light Up with Windows 7 Libraries | yoursoftwarelink.com on April 17, 2009 at 8:37PM

    Pingback from  Light Up with Windows 7 Libraries | yoursoftwarelink.com

  32. Posted by: Technology Info » Light Up with Windows 7 Libraries on April 18, 2009 at 7:03AM

    Pingback from  Technology Info  » Light Up with Windows 7 Libraries

  33. Posted by: Windows 7 Libraries Truely Enhance Your Experience | Windows 7 Resource Center on April 18, 2009 at 2:18PM

    Pingback from  Windows 7 Libraries Truely Enhance Your Experience | Windows 7 Resource Center

  34. Posted by: Windows 7 will be fun at fishbrains - Bret Fisher on April 20, 2009 at 5:28AM

    Pingback from  Windows 7 will be fun at fishbrains - Bret Fisher

  35. Posted by: Windows 7 for Developers on April 23, 2009 at 6:16PM

    This is the fifth post about Windows 7 Libraries. By now, you should be familiar with Windows 7 Libraries

  36. Posted by: Consuming the Contents of Windows 7 Libraries | Windows Seven 7 on April 23, 2009 at 7:08PM

    Pingback from  Consuming the Contents of Windows 7 Libraries | Windows Seven 7

  37. Posted by: Consuming the Contents of Windows 7 Libraries | Windows 7 Information, News, Downloads, Support Forums on April 24, 2009 at 12:08AM

    Pingback from  Consuming the Contents of Windows 7 Libraries | Windows 7 Information, News, Downloads, Support Forums

  38. Posted by: linkfeedr » Blog Archive » Consuming the Contents of Windows 7 Libraries - RSS Indexer (beta) on April 24, 2009 at 7:11PM

    Pingback from  linkfeedr » Blog Archive » Consuming the Contents of Windows 7 Libraries - RSS Indexer (beta)

  39. Posted by: US ISV Developer Evangelism Team on April 25, 2009 at 5:37PM

    The release candidate (RC) for Windows 7 is just around the corner. Dates for the Windows 7 RC were announced

  40. Posted by: Microsoft gets it right with Windows 7 | Andrew Kantor's Place on April 26, 2009 at 8:10PM

    Pingback from  Microsoft gets it right with Windows 7 | Andrew Kantor's Place