Tuesday, November 19, 2013

Add/Remove Music and Video folders from Windows 8.1 Store Applications

    This is a functionality so buried inside the MSDN documentation that I had to "look" at another application that uses it and only after I was able to find the documentation for it. For the moment (guess because it was not given enough visibility yet) I think there is only one store application that uses it and it is, of course, built by Microsoft (not even Nokia Music application uses it). 
    So what is this all about? If you develop a store application that uses the MusicLibrary capability, you can access to the audio files inside the Music library folders. The problem, until now, was that there was no way to add/remove folders to/from the Music library inside a store application so, in case the user did not had any folder added to the Music library the developers had to find a way to explain how to manually add folders to the Music library (a mess believe me).
    The missing functionality is implemented by the NEW StorageLibrary class available for Windows 8.1 store applications. The class is actually a diamond in the rough:

    The usage is basic but it is exactly what I needed. You need to use the GetLibraryAsync method to retrieve the StorageLibrary you need. Once you have it you can retrieve the StorageFolders currently added to the library and for the Music and Videos libraries, you can add or remove folders from this library. If removing a folder from the library the user will be prompted if he agrees with the removal. For adding a folder using the async method the user will be prompted with a folder picker and returns the newly added StorageFolder, otherwise null.
    As usually I really hope that, if you need it, this blog post will spare you the hours I've spent in finding out how it is done.

Update: There is also a code sample available on msdn Library management sample



  1. Now a days Mobile Development is growing very fast and i this post you have shared really informative and unique content on mobile development.


    Ricky Broad


  2. Hello,
    I am David Warner... really i enjoyed your blog.it is very good blog for us.. we are provide T-Mobile Prepaid Dealer is the new presentation of the house of the Gosmart mobiles. It is a connection networking series which is launched keeping in mind those who have a low range of income. This connection has a range of plans which are affordable as well as readily available. T-Mobile Dealers New York . It is easy to find a reputed and renowned GoSmart store which has sprung into limelight with its highest-rated services being offered at the lowest possible price. More Information At Pccwireless.com. if you interested for GoSmart Dealer .so ping here T-Mobile Prepaid Dealership ... more information about GoSmart authorized dealer at http://www.pccwireless.com .it is better for us.