Windows 7 Libraries .NET Sample Library – an Overview

Libraries are the primary entry points to user data in Windows 7. They are the natural evolution from the user’s Known Folders, including those for documents, pictures, music, and videos. However, before jumping into the technicalities, let’s try to explain what a Library in Windows 7 is. A Windows 7 Library is a user-defined collection of content that represents the user’s data independently from the folder hierarchy. Users can unify and flatten the folder hierarchy by aggregating any number of physical locations (on their local machine or on remote machines) into a single view – which is the library. By including folders in Libraries, users tell Windows where their important data are located. In Windows 7 therefore, most applications should use a Library instead of the user’s Known Folders. It is important to note that as Libraries are an integral part of the Windows Shell, they play a greater role in the Windows 7 Explorer user experience. Accordingly, the importance and integration points of Libraries span multiple parts of the Windows Shell, including the Common File Dialog, Folder Picker, and the Windows Explorer Browser control (not Internet Explorer!).

This is the first post in a series of Library posts. It provides an overview of both the Windows 7 Library functionality and the Libraries Sample .NET Interop Library, which is a managed code wrapper and part of the Windows 7 .NET Interop Sample Libraries. The second post is all about Understanding Windows 7 Libraries. In future posts, we will dive into the internal implementation of Libraries as well as how to use the Libraries programming model and APIs.

If you are unfamiliar with and haven’t seen any demonstrations of the updated Windows 7 Shell and Libraries in action, I suggest you watch the Windows 7: Find and Organize Part 1 webcast on Channel 9. This will give you some context for the technical material we cover here.

Let’s review the Windows 7 Libraries .NET Interop Sample Library architecture and note the important classes. Please remember that the Libraries sample is part of the Taskbar and Libraries assembly. Since both Taskbar and the Libraries share many common integration points with the Windows Shell, it makes sense to have them grouped together and use the same Shell structures and methods.

Opening the solution reveals the following structure:

  • The Demos folder containing several demo projects that show the various aspects of both the Taskbar and Libraries wrappers as you can see from the image; we will focus on the Libraries
  • The Wrappers folder containing the Windows7.DesktopIntegration assembly, which is the main manager API for both the Taskbar and Libraries
  • A modified version of the Vista Bridge Sample Library - We based our code on the 1.4 version. And as mentioned before, the Windows Vista bridge Project will be superseded by the new Windows API Code Pack for the .NET Library
image

Let’s take a quick look at the main class that enables developers to take advantage of the new Library functionality. The ShellLibrary.cs file contains the ShellLibrary class, which is the main entry point for managed code developers. Using the ShellLibrary, developers can programmatically perform all Library operations, including:

  • Create new library
  • Load existing library
  • Delete library
  • Add / remove folders from the library
  • Set the default save location of the library
  • Set the folder type
  • Show the library management dialog box
  • Set the library icon
  • Pin and unpin the library from the left navigation pan in Windows Explorer

The demos in the Libraries folder highlight all the above-mentioned Library functionality. Let’s review them:

  • The LibraryManagerDemo is a Windows Presentation Foundation (WPF) application that showcases all the functionality offered by libraries. It is a very simple application that offers developers a great opportunity to review all the above-mentioned Libraries functionality.

image

  • The SLUtil (not Silverlight) is a command line interface that allows users and developers to manage their Libraries. Again, it offers all the above-mentioned Libraries functionality.

image

Here are some additional resources for programming Windows 7 Libraries:

View Channel 9 videos:

Additional blog posts

 

Alon Fliess contributed to this post


Comments

  1. Posted on: April 07, 2009 at 12:19AM  

    While I like the idea of the Libraries, I've sort of been turned off by its execution since trying out the software. For example, seeing all of the folders inside of the primary folder is a bit annoying and just adds to the clutter. Is there a way to hide the subfolders? For example, if I have 3 subfolders inside of the Pictures folder I don't want to see all of the folders when I click on Pictures - I just want to see all of the contents.

  2. Posted on: April 07, 2009 at 2:06AM  

    I'm not sure I understand this...once again the link you've given for the managed wrapper is code.msdn.microsoft.com/.../ProjectReleases.aspx

    Are the managed wrappers for Libraries and the Taskbar in the same archive?

  3. Posted on: April 08, 2009 at 11:50AM  

    @DameonW, each library exposes a number of different "arrangement views" for browsing the contents of the library.  One of them is the "Folder" view, where you see all the sub-folders, but if you click on the "Arrange by:" dropdown along the top of the library window you can try out other views where sub-folders are not shown. For example, the "Artist" or "Genre" views in the music library or the "Month" or "Day" views in the picture library, or the "Author" or "Date Modified" views in the documents library.

  4. Posted on: September 01, 2009 at 12:41AM  

    the content of windows 7 parts of the system a lot I liked about this part of the menu like vista I'm glad to have him thank you also for your news

Trackbacks

  1. Posted by: Windows 7 Libraries .NET Sample Library ??? an Overview - Windows 7 … | Current Technology Updates daily on April 06, 2009 at 9:27PM

    Pingback from  Windows 7 Libraries .NET Sample Library ??? an Overview - Windows 7 … | Current Technology Updates daily

  2. Posted by: Understanding Windows 7 Libraries - Windows 7 for Developers - The Windows Blog on April 06, 2009 at 10:08PM

    Pingback from  Understanding Windows 7 Libraries - Windows 7 for Developers - The Windows Blog

  3. Posted by: Windows 7 Libraries .NET Sample Library ??? an Overview - Windows 7 … | networking-the.info on April 06, 2009 at 10:40PM

    Pingback from  Windows 7 Libraries .NET Sample Library ??? an Overview - Windows 7 … | networking-the.info

  4. 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

  5. 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

  6. Posted by: Overview: Windows 7 Libraries .NET Sample Library on April 07, 2009 at 3:36AM

    Pingback from  Overview: Windows 7 Libraries .NET Sample Library

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

    Pingback from  Understanding Windows 7 Libraries « zK++ Blogosphere

  8. 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

  9. Posted by: You Get The . Info » Understanding Windows 7 Libraries - 24th Edition on April 07, 2009 at 8:17AM

    Pingback from  You Get The . Info » Understanding Windows 7 Libraries - 24th Edition

  10. Posted by: Understanding Windows 7 Libraries | yoursoftwarelink.com on April 07, 2009 at 11:33AM

    Pingback from  Understanding Windows 7 Libraries | yoursoftwarelink.com

  11. Posted by: Windows 7 Libraries .NET Sample Library ??? an Overview|Join Our Story!|AngNetwork Blog on April 07, 2009 at 2:35PM

    Pingback from  Windows 7 Libraries .NET Sample Library ??? an Overview|Join Our Story!|AngNetwork Blog

  12. Posted by: Understanding Windows 7 Libraries | Windows 7 Information, News, Downloads, Support Forums on April 07, 2009 at 4:03PM

    Pingback from  Understanding Windows 7 Libraries | Windows 7 Information, News, Downloads, Support Forums

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

    Pingback from  Understanding Windows 7 Libraries « Central Blogosphere

  14. Posted by: US ISV Developer Evangelism Team on April 25, 2009 at 6:27PM

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

  15. Posted by: Understanding Windows 7 Libraries | Blog on May 10, 2009 at 3:46PM

    Pingback from  Understanding Windows 7 Libraries | Blog

  16. Posted by: Windows 7 for Developers on June 11, 2009 at 11:51AM

    Last updated: June 11, 2009 This post is an index to the recent Windows 7 Libraries series. It includes

  17. Posted by: Windows 7 Programming Guide ??? Libraries | Windows Seven 7 on June 11, 2009 at 12:23PM

    Pingback from  Windows 7 Programming Guide ??? Libraries | Windows Seven 7

  18. Posted by: BloggersBase Computers on June 11, 2009 at 1:42PM

    Windows7 have both positive and negative features.All cannot be found at a one place there are some reference about the program guide and library features which i go through the msn blog while...

  19. Posted by: Windows 7 Programming Guide ??? Libraries | Windows 7 Information, News, Downloads, Support Forums on June 12, 2009 at 12:34AM

    Pingback from  Windows 7 Programming Guide ??? Libraries | Windows 7 Information, News, Downloads, Support Forums

  20. Posted by: You Get The . Info » Windows 7 Programming Guide ??? Libraries - 300th Edition on June 16, 2009 at 9:32PM

    Pingback from  You Get The . Info » Windows 7 Programming Guide ??? Libraries - 300th Edition

  21. Posted by: Windows 7 Programming Guide – Libraries « Windows Club on June 20, 2009 at 1:19AM

    Pingback from  Windows 7 Programming Guide – Libraries « Windows Club

  22. Posted by: Windows 7 Programming Guide – Libraries « Agave Anejo's Blog on June 21, 2009 at 10:52AM

    Pingback from  Windows 7 Programming Guide – Libraries « Agave Anejo's Blog

  23. Posted by: Nuno Filipe Godinho on November 16, 2009 at 4:37PM

    Overview In previous versions of windows, users managed files in known folders locations Documents, Pictures

  24. Posted by: Nuno Filipe Godinho on November 16, 2009 at 4:38PM

    Overview In previous versions of windows, users managed files in known folders locations Documents, Pictures

  25. Posted by: Windows 7 Libraries at Some Notes in Microsoft on November 25, 2009 at 12:19PM

    Pingback from  Windows 7 Libraries at Some Notes in Microsoft

  26. Posted by: Windows 7????????? | Derek's Blog on December 12, 2009 at 11:26PM

    Pingback from  Windows 7????????? | Derek's Blog