In Umbraco 7, how can I search for all members with a custom property?
I am using Umbraco 7 (C #).
Is there an easy way / method to find all members with a custom property?
I know there is an easy way to find all members by username using the method
GetByUsername(string username) : returns IMember
And also for searching by email:
GetByEmail(string email) : returns IMember
Do you know about this way of searching by property?
I've tried using the ".Where" method like this:
GetService().GetAllMembers().Cast<IMember>().Where("permalink=SOMESTRING").ToArray();
Unfortunately, there is an error as I cannot use the .Where () method here.
Any suggestions?
thank
+3
source to share
1 answer
You can just use the build function in MemberService.
From the doc:
Services.MemberService
.GetMembersByPropertyValue("city", "Horsens");
//Returns all Members, of any type, with a mathcing value in the property with the given property alias
http://our.umbraco.org/documentation/Reference/Management-v6/Services/MemberService
+8
source to share