Copied to clipboard

Flag this post as spam?

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


  • UmbracoTests 29 posts 180 karma points
    Aug 24, 2020 @ 22:10
    UmbracoTests
    0

    'IPublishedContent' does not contain a definition for

    I created a document type with a few properties and added permissions where users can add them from the homepage.

    How do I access the poperties?

    I tried the following but got an error saying :

    Compiler Error Message: CS1061: 'IPublishedContent' does not contain a definition for 'EndDate' and not accessible extension method 'EndDate' accepting a first argument of type 'IPublishedContent' could be found (are you missing a using directive or an assembly reference?)

    Code I used is as follows:

    var testNode = Model.Value<IPublishedContent>("testNodePageLink");
    var systemTests = testNode.Children.Where(x => x.IsVisible() && x.ContentType.Alias == "testItem");
    var count = systemTests .Where(i => i.EndDate > DateTime.Now).Count();
    
  • UmbracoTests 29 posts 180 karma points
    Aug 25, 2020 @ 19:38
  • 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