Copied to clipboard

Flag this post as spam?

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


  • Marko Radosevic 2 posts 83 karma points
    Jan 21, 2016 @ 20:54
    Marko Radosevic
    0

    Access and get not published content with Umbraco content API.

    Hi all,

    First off all I need to say that I am new to umbraco, recently started to exploring it's posibilities. So far I enjoy using it, easy to instal, develop and there are a loot of questions answered on comunitiy. Great job umbraco!

    I am wondering if there is a way for me to create some custom data repository or something like that? My demand is to be able to save user's input (this could be some form submit from front office by web site visitors). I need to save this submited form into umbraco, but I don't want this to be published and visible on front office side.

    I know that I am able to save this in content section with content API, but I do not want this data to be published and visible outside backoffice. So far I tried to just save this users input to centent but not to publish it, in this case I have problem because if content is not publised I cannot access it from content API, or maybe there is a way to access not published content with content API?

    If someone have some idea how this could be implemented please let me know.

    Thanks in advace.

  • Alex Skrypnyk 6147 posts 24056 karma points MVP 8x admin c-trib
    Jan 22, 2016 @ 13:53
    Alex Skrypnyk
    100

    Hi Marko,

    1) The easiest way to save user's input from forms is to use Umbraco Forms

    http://umbraco.com/products-and-support/forms/

    All data will be stored at Forms section in Umbraco admin, and it's easy to maintain.

    2) Of course, you can unpublished data from API. ContentService returns upublished and published nodes.

    https://our.umbraco.org/documentation/reference/management/services/contentservice

    Thanks,

    Alex

  • Marko Radosevic 2 posts 83 karma points
    Jan 22, 2016 @ 15:53
    Marko Radosevic
    1

    For option 2, code sample to show how we can access nodes that are not published and those that are published.

    //1057 is id for parent node.
    
        var unpublishedAndPublishedNodes = Services.ContentService.GetChildren(1057);
    
Please Sign in or register to post replies

Write your reply to:

Draft