Find page by title and grouping page's title
I have the following code, which finds a page where the page title is "ABC" and the parent's title is "XYZ". This works well, but not if the parent is a grouping page. I can't find any properties indicating the title of a grouping page. I could probably do it some way by figuring out the URL.
var page = App.WorkWith().Pages().LocatedIn(PageLocation.Frontend).Where(p => p.Title ==
"ABC"
&& p.Parent !=
null
&& p.Parent.Title ==
"XYZ"
&& p.ApprovalWorkflowState ==
"Published"
).Get().FirstOrDefault();
Hello Eric,
Try using UrlName property.
Kind regards,
Ivan Dimitrov
the Telerik team
I guess it didn't have anything to do with the title. It was the ApprovalWorkflowState value, which was null for the grouping page. I changed it to the following and it seems to work...
var page = App.WorkWith().Pages().LocatedIn(PageLocation.Frontend).Where(p => p.Title == "ABC" && p.Parent !=
null
&& p.Parent.Title ==
"XYZ"
&& (p.NodeType == NodeType.Group ||
"Published"
.Equals(p.ApprovalWorkflowState))).Get().FirstOrDefault();