+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Getting all locked pages

Getting all locked pages

7 posts, 0 answered
  1. Olivier
    Olivier avatar
    57 posts
    Registered:
    09 Jul 2010
    22 Mar 2011
    Link to this post
    Hi,

    I need to get a list of all locked pages in the site.

    Can I do it with CmsManager.GetPages() and a CmsQueryCondition like below in my (non-working) example ? ("StagedPageContent.Locked" is invalid for the CmsQueryCondition - what would be a valid key/path  ? )

    var cmsManager = new CmsManager();
     
    var condition = new CmsQueryCondition(
            "StagedPageContent.Locked",
            Nolics.ORMapper.Base.QueryCondition.EQ,
            1);
     
    var listConditions = new List<CmsQueryCondition>() { condition };
     
    int count;
    var lockedPages = cmsManager.GetPages(
        0, 10,
        string.Empty,
        System.ComponentModel.ListSortDirection.Descending,
        listConditions,
        out count);

    Or do I have to check the whole Sitemap, page by page ?

    Thanks

    Olivier
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    22 Mar 2011
    Link to this post
    Hello Olivier,

    You can use the IPage object.

    if (p.Staged.Locked)
           

    You should get all cms pages with the CmsManager and its GetPages() method and then loop through them.

    All the best,
    Ivan Dimitrov
    the Telerik team
  3. Olivier
    Olivier avatar
    57 posts
    Registered:
    09 Jul 2010
    23 Mar 2011
    Link to this post
    Hi Ivan,

    Yeah, I know I can do it this way, but I was asking if it was possible to filter directly from the cmsManager.GetPages() method with the condition parameter. I suppose it would be faster, if it was possible...

    But thanks,

    Olivier
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    23 Mar 2011
    Link to this post
    Hello Olivier,

    You can create a new query condition

    List<CmsQueryCondition> conditions = new List<CmsQueryCondition>();

    conditions.Add(new CmsQueryCondition("param", Nolics.ORMapper.Base.QueryCondition.EQ, object param));

    and then use the GetPages method  of the manager.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
  5. Olivier
    Olivier avatar
    57 posts
    Registered:
    09 Jul 2010
    23 Mar 2011
    Link to this post
    Yeah ok, but is it possible to create a condition such as:

    new CmsQueryCondition("IS_PAGE_LOCKED", Nolics.ORMapper.Base.QueryCondition.EQ, True));

    Thanks,

    Olivier
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    28 Mar 2011
    Link to this post
    Hello Olivier,

    You can add only the following  values to the query pat

    [Title]
    [Description]
    [Keywords]
    [WorkflowID]
    [Application]
    [LangID]
    [ID]


    [Application]
    [LangID]
    [ID]
    [Version]
    [MasterPage]
    [Theme]
    [ContainsUrlSrvc]
    [DateCreated]
    [DateModified]
    [Stamp]
    [Status]
    [UrlServicesHash]
    [WorkflowStatus]
    [LastModifier]
    [TemplateID]
    [ItemType]

    These are the columns from CmsPageContent  and PageContentBase tables. The locked value comes from StagedPage and you cannot use the CmsQueryCondition

    Greetings,
    Ivan Dimitrov
    the Telerik team
  7. Olivier
    Olivier avatar
    57 posts
    Registered:
    09 Jul 2010
    31 Mar 2011
    Link to this post
    Thank you
Register for webinar
7 posts, 0 answered