So I have taken some Photos on my windows phone emulator and I am then trying to find them in my application. So Far I have:
PictureCollection CameraRollPictures;
using (var library = new MediaLibrary())
{
//taking all albums
PictureAlbumCollection allAlbums = library.RootPictureAlbum.Albums;
//taking Camera Roll album separately from all album
PictureAlbum cameraRoll = allAlbums.Where(album => album.Name == "Camera Roll").FirstOrDefault();
// here you will get camera roll picture list
CameraRollPictures = cameraRoll.Pictures;
}
But this keeps crashing because cameraRoll = null
. Is this feature available on WP8 emulator or am I doing something wrong?
My method to get photos is from this stackoverflow question
EDIT
I have also tried album.Name == "Camera Roll"
So the answer was simple... My method worked perfectly but I needed to:
ID_CAP_MEDIALIB_PHOTO
This provides read-only access to photos in the media library