Copied to clipboard

Flag this post as spam?

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


  • dev-thandabantu 41 posts 321 karma points
    Aug 17, 2022 @ 13:10
    dev-thandabantu
    0

    Getting all unpublished content

    Hi.

    Can someone please help me understand how Umbraco saves data into a DB. Maybe the question is too generic but bear with me as I explain.

    I am trying to get unpublished content that I would like to display in the backoffice. When I click "Send for approval" in the backoffice, I would like to know how I would query for this content in my SearchController.cs class. I found this approach (shoutout to JonDJones!): SearchService

    but I don't really understand the whole query. I have been searching my DB in SQL Server Management Studio to trying to figure out which tables are updated when I click the "Send for approval" button but I haven't been successful yet. So my question is, how do I check/know which tables are updated when I click this button (or any other button in general)?

    Thank you.

  • dev-thandabantu 41 posts 321 karma points
    Aug 20, 2022 @ 14:57
    dev-thandabantu
    100

    I ended up injecting the content type service (IContentTypeService) and using that to get all the content types. Looping through the list, I got the content type alias of each item and used the aliases to get the all content (published/unpublished). Here are the code snippets:

    Get all content types:

    var allContentType = _contentTypeService.GetAll();
    

    And then get the alias (and use it):

                var contentList = new List<ISearchResults>();
                foreach (var contentType in allContentType)
                {
                    orderedExamineQuery = searcher.CreateQuery(IndexTypes.Content).NodeTypeAlias(contentType.Alias).OrderBy(new SortableField[] { new SortableField(DocumentTypeConstants.PropertyAlias.PostDate) })
                        .Execute();
                    contentList.Add(orderedExamineQuery);
    
                }
    
Please Sign in or register to post replies

Write your reply to:

Draft