Copied to clipboard

Flag this post as spam?

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


  • K.Garrein 164 posts 629 karma points
    Oct 29, 2019 @ 10:38
    K.Garrein
    0

    Trouble with retrieving content after updating from v8.0.2 to v8.2.1

    In our code for v8.0.2 we used many times things like:

    var Training = TrainingEvent.GetProperty( "training" ).Value<List<IPublishedContent>>().First();
    

    But returining a List of IPublishedContent doesn't seem to work anymore in v8.2.1 On the macro's we can use a replacement like:

    var Training = TrainingEvent.Value<Umbraco.Web.PublishedModels.Training>( "training" );
    

    But in other classes "Umbraco.Web.PublishedModels.CLASSNAME" doesn't seem to be accessible!? How do I get to the content in class code?

    When debugging and placing a breakpoint, it actually states that the data is of the "Umbraco.Web.PublishedModels.CLASSNAME" type, but when using that type specifier the website errors out... (like the second code example above)

    Thank you.

  • K.Garrein 164 posts 629 karma points
    Oct 29, 2019 @ 11:15
    K.Garrein
    100

    Apparently "List IPublishedContent" has changed to just "IPublishedContent" !?

    If I use the following (anywhere), it works, so problem solved:

    var Training = TrainingEvent.Value<IPublishedContent>( "training" );
    
  • 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