65.9K
CodeProject is changing. Read more.
Home

How to easily retreive your local photos, music, and playlists

starIconstarIconstarIconstarIconstarIcon

5.00/5 (2 votes)

Dec 2, 2013

CPOL
viewsIcon

5860

This tip shows you how to easily retrieve your local images, playlists, and music in Windows Phone 8.

Introduction

This tip shows you how to easily retrieve your local images, playlists, and music in Windows Phone 8. 

Background

You want to create a Windows Phone 8 and you need to use or retrieve some data from your Windows Phone 8 Device. This is the case of your photos, your music, and your playlists. So, you mustn't forget the capabilities: ID_CAP_MEDIALIB_[AUDIO | PHOTO | PLAYLIST]

Using the code  

In order to retrieve your photos stored in your device, add the following code:

using (var library = new MediaLibrary())
{
   var images = library.Pictures;
}

To retrieve your local music, choose the property Songs of the object called library

library.Songs

And the same for the playlists:

library.Playlists

With these methods, you are able to save photos or music with some exceptions. Regarding music: it is important that the music you want to save is stored in the Isolated Storage of your application. For images, it is a little different, and you can pass a stream on your method.