var selection = Umbraco.ContentAtRoot().FirstOrDefault().Children().Where(x => x.GetPropertyValue<bool>("menuUtil").Value == true);
Error : 'IPublishedContent' does not contain a definition for 'GetPropertyValue' and no accessible extension method 'GetPropertyValue' accepting a first argument of type 'IPublishedContent' could be found
var selection = Umbraco.ContentAtRoot().FirstOrDefault().Children().Where(x => Convert.ToBoolean(x.GetProperty("menuUtil").Value) == true);
Argument 1: cannot convert from 'method group' to 'object'
Help with querying
Hello. I'm new to Umbraco. I tried to get every pages with a boolean value to true but I don't seems to get it right. Here's my code right now :
I've also tried .GetPropertyValue
Thanks for your help!
Hi Marc-Andre
I assume the property "menu" is a toggle (Yes/No)
If so then try
You do need the double equals, and cast the property as a bool.
If this doesn't work then maybe this
Cheers
Nigel
Hi Nigel,
Yes menu is a "checkbox" type.
Both of them don't work :(
Error : 'IPublishedContent' does not contain a definition for 'GetPropertyValue' and no accessible extension method 'GetPropertyValue' accepting a first argument of type 'IPublishedContent' could be found
Argument 1: cannot convert from 'method group' to 'object'
Hi Marc-Andre,
In Umbraco 8 the
GetPropertyValue()
method is not available anymore.Instead you have to use the
Value()
method. So, applied to your situation:YES! Thanks a lot Corné!
is working on a reply...