MediaUrl is null
MediaUrl throws exception - This is not a natural development experience.
I am retrieving the album and then I try to get the media url and it throws an exception. I am trying to bind a list of images from an album to a listview. Let me know what I am doing wrong.
Hi Jaime, are you attempting to do this programmatically via the API? Can you provide me with a sample of the code you are attempting to run?
Also, what specific exception are you getting?
var manager =
new
LibrariesManager();
var album = manager.GetAlbums().FirstOrDefault();
if
(album !=
null
)
DataSource = album.Images.Take(4).ToList();
ProjectImagesListView.DataSource = DataSource;
Object reference not set to an instance of an object
on what line are you getting the exception? does the album return null as well?
I haven't yet tried your code, however looking at it can you try changing the first line new LibrariesManager() to
var manager = LibrariesManager.GetManager()
only the mediaurl returns null
Jaime, sorry about the delay in following up on this. it took me some time to recreate the issue.
It appears this may be due to a change in the Url implementation in 5.0. Instead of referencing the Url property directly, there appears to be a ItemDefaultUrl property instead that seems to correctly refer to it.
The Urls array appears to now be populated, so alternatively you can do image.Urls[0].Url
hope this is helpful!
I had the same issue recently. It used to work but it just stoped giving me the MediaUrl. So had to rework the code.