MediaUrl is null

Posted by Community Admin on 03-Aug-2018 00:54

MediaUrl is null

All Replies

Posted by Community Admin on 05-Apr-2012 00:00

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.

Posted by Community Admin on 05-Apr-2012 00:00

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?

Posted by Community Admin on 05-Apr-2012 00:00

var manager = new LibrariesManager();
var album    = manager.GetAlbums().FirstOrDefault();
if (album != null)
    DataSource = album.Images.Take(4).ToList();
 
ProjectImagesListView.DataSource = DataSource;

Posted by Community Admin on 05-Apr-2012 00:00

Object reference not set to an instance of an object

Posted by Community Admin on 05-Apr-2012 00:00

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()

this is the preferred method for instantiating the manager as it uses the Default provider.

let me know if that makes any difference

Posted by Community Admin on 05-Apr-2012 00:00

only the mediaurl returns null

Posted by Community Admin on 12-Apr-2012 00:00

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!

Posted by Community Admin on 13-Apr-2012 00:00

I had the same issue recently. It used to work but it just stoped giving me the MediaUrl. So had to rework the code.

This thread is closed