Copied to clipboard

Flag this post as spam?

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


  • Dean 8 posts 98 karma points
    Oct 05, 2016 @ 03:42
    Dean
    0

    Oops: this document is published but not in the cache

    When i navigate to some pages in the backend i get this error.

    Oops: this document is published but not in the cache

    When i republish the site nothing changes, and when i try to get an unpublished page by id for example

    Umbraco.TypedContent(1200).Name
    

    it breaks the site.

    Any ideas why this is happening? there are no errors in the log. And is there another way to access the pages name without crashes the site.

    Thanks Dean

  • Steve Morgan 1349 posts 4458 karma points c-trib
    Oct 05, 2016 @ 08:47
    Steve Morgan
    0

    Hi Dean,

    Umbraco.TypedContent() returns an object of type IPublishedContent - i.e. you can only use this for published content - it uses the cache which only contains published content nodes.

    If you want to get access to unpublished nodes then you should use the ContentService. Note, this will hit the DB so should not be used on pages served to visitors but only for admin / backend / updates etc.

    var cs = ApplicationContext.Current.Services.ContentService;
    IContent unpubNode = cs.GetById(1200);
    

    Use the ContentService with care - it really should only be used used for the CUD of CRUD operations!

    As for your other error - this is usually due to a corrupt cache - what version of Umbraco is this?

    HTH

    Steve

  • Dean 8 posts 98 karma points
    Oct 06, 2016 @ 03:49
    Dean
    0

    Thanks Steve, Manually republishing all the pages parents ended up fixing this issue for me. It is version 7.5.3

    Being able to grab unpublished pages is unfortunately necessary for me, i only need to see there name so hopefully that wont cause many issues.

    Thanks again for your reply.

Please Sign in or register to post replies

Write your reply to:

Draft