Copied to clipboard

Flag this post as spam?

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


  • Brett Spencer 11 posts 31 karma points
    Nov 10, 2014 @ 18:11
    Brett Spencer
    0

    API - return all items under listview node

    I created a document-type called "Item-List-Folder" that is a generic object to hold any and all lists of other document types.  

    I am currently setup to use it as a News folder and a Video folder.

    I have been through ALL of the video tutorials and they are referencing the use of Services.ContentService.

    So I have been trying to return a list of all the videos under the video item-list-folder and not getting anywhere.

     

        public class VideoApiController : UmbracoApiController
        {
    
            public IEnumerable GetAllVideos()
            {
                var videoList = Services.ContentService.GetChildren(1077);
                return videoList;
            }
        }

    How do I return a list of all items under a node assigend as ListView?

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Nov 10, 2014 @ 23:22
    Alex Skrypnyk
    0

    Hi Brett,

    Try like that:

    public IEnumerable<IContent> GetAllVideos()
    {
        var videoList = Services.ContentService.GetChildren(1077);
        return videoList;
    }
    

    What wrong with your code?

    1077 - is it id of parent node what you want?

    Is your content published ?

    Thanks

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft