PageCriteriaQueryService.FindPagesWithCriteria to find Pages that are shortcuts/fetch data

Vote:
 

Is it possible to do an IPageCriteriaQueryService.FindPagesWithCriteria to find pages whos LinkType is a shortcut or Fetch Data ?

Here is what I am trying but with no success.

var criterias = new PropertyCriteriaCollection();

            criterias.Add(new PropertyCriteria()
            {
                Condition = EPiServer.Filters.CompareCondition.Equal,
                Name = "LinkType",
                Type = PropertyDataType.Number,
                Value = ((int)PageShortcutType.FetchData).ToString(),
                Required = true
            });

            var pages = pageCriteriaQueryService.FindPagesWithCriteria(rootPage.PageLink, criterias);

Any help appreciated.

thanks

#112532
Oct 29, 2014 16:22
Vote:
 

Try to set the name of the property to "PageShortcutType".

#112535
Oct 29, 2014 16:30
Vote:
 

Excellent, that worked! Thanks!

But how ?

I can see the Property named LinkType has a type of EPiServer.Core.PageShortcutType.

I have searched before based on PageTypeID which is the Name of the property not its type ?

Is there some resources that explain how to use the IPageCriteriaQueryService more efficiently ?

Also I can't see how to mark the reply at the "answer" ?

#112543
Oct 29, 2014 16:55
Vote:
 

IPageCriteriaQueryService is using the "old" untyped way of handling data, that means it operates on the backing PropertyDataCollection rather than the typed model (the c# class). And the property PageData.LinkType is backed in a property named "PageShortCutType". If you use EPiServer Find then you can do queries with your typed model.

If you attach a debugger and look at a PageData instance you can see that it has a property named "Property" of type PropertyDataCollection, there you can see all the properties and the name of the backing PropertyData instance.

#112544
Oct 29, 2014 17:03
Vote:
 

Brilliant!

Thanks for your help.

#112545
Oct 29, 2014 17:04
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.