Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David Clapperton 7 posts 57 karma points
    Jun 26, 2014 @ 10:44
    David Clapperton
    0

    Getting a list of media with MediaService

    Hey, can anyone tell me if there is a simple way get a list of all media using the MediaService I thought i would be able to use:

    mediaService.GetDescendants(-1)

    However this doesn't seem to work. 

    library.GetMedia(-1, true);

    This returns all media but returns XPathNodeIterator

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Jun 26, 2014 @ 10:58
    Dennis Aaen
    0

    Hi David and welcome to our,

    I´m not a backend developer, so I don´t know if this is possible.

    But with the .GetRootMedia() you should get get a Enumerable list of Media objects, which reside at the first level / root.

    When you have the root, can´t you then take the Children, or Descendants?

    .GetChildren(int parentId)

    Gets a Enumerable list of Media objects by parent Id.

    .GetDescendants(int parentId)

    Gets Enumerable list descendants of a Media object by its parent Id.

    Hope this can help you,  allthough I'm not backend developer.

    /Dennis

  • David Clapperton 7 posts 57 karma points
    Jun 26, 2014 @ 11:11
    David Clapperton
    0

    Hi Dennis thanks for the reply. Ye i guess i could use .GetRootMedia() Which returns a list of the top level folders and files and then iterate over the decendants and add them to one list. Was hoping there was something a little simpler than this though.

    After testing library.GetMedia(-1, true); doesn't return all media either.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies