Copied to clipboard

Flag this post as spam?

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


  • AsheM 19 posts 120 karma points
    May 28, 2020 @ 20:11
    AsheM
    1

    Youtube Picker only returning the first value instead of all the picked videos

    Im using the youtube picker for channel on 7.15.3 and it used to work, but now it's only returning the first video of all the picked videos. this is my code:

    YouTube videos = null;
    
    try
    {
        videos = Model.GetPropertyValue<YouTube>("agentJoinVideos");
    }
    

    In the picker I have 3 videos selected, getting the count of this object is just 1 the first one. Is there an update I missed or how do I get it back? if I switch the order of the videos the video will change but it's still only the first.

  • Joep 96 posts 698 karma points
    May 29, 2020 @ 08:42
    Joep
    1

    Hi,

    Shouldn't you get a list of videos? So something like this:

    List<YouTube> videos = new List<YouTube>();
    
    try
    {
        videos.AddRange(Model.GetPropertyValue<List<YouTube>>("agentJoinVideos"));
    }
    

    -Joep

  • AsheM 19 posts 120 karma points
    Jun 01, 2020 @ 12:33
    AsheM
    0

    So this code worked before, its legacy code I'm trying to get working again.

    I tried your solution but I got an error that said:

    'YouTube' does not contain a definition for 'AddRange' and no accessible extension method 'AddRange' accepting a first argument of type 'YouTube' could be found

    So, back to square one.

  • Joep 96 posts 698 karma points
    Jun 01, 2020 @ 17:32
    Joep
    0

    Hi,

    Well the error that is given implies that you are using the extension on something that isn't a list. Did you also copy the List part over?

    -Joep

  • AsheM 19 posts 120 karma points
    Jun 02, 2020 @ 12:40
    AsheM
    0

    So I went back and got the list working and accessed the list but now, although it builds, it's not displaying any videos even the main one. I'm wondering if the update we did from 7.5.3 to 7.15.3 is the likely culprit. I'm thinking there must have been a change in the way this datatype is passed perhaps because this code worked for years and now it just doesn't.

  • Joep 96 posts 698 karma points
    Jun 03, 2020 @ 07:25
    Joep
    0

    Hi,

    When you did the update for Umbraco, did you also update the package? Try debugging it so see if the list is empty.

    -Joep

Please Sign in or register to post replies

Write your reply to:

Draft