Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get properties from Members in Umbraco (In Usercontrol)

I've made a Umbraco site, and ive got some members that i need to display information about in a usercontrol(ascx) page. But the only thing i can find is the old umbraco api, with the m.GetProperty(); method like:

foreach (Member m in Member.GetAll) {
    m.getProperty("danceStyles");
}

But visual studio says that Member is obsolete and i should use Membership instead, but i dont know how i can get generic properties from a member through that. Only thing i can get is Username, Email and Password, and not properties i define in umbraco...

like image 860
Christian Bekker Avatar asked Dec 21 '12 08:12

Christian Bekker


1 Answers

Yah, Member.GetAll is obsolete but I suppose you could use Member.GetAllAsList() this method is to get members in List, This method works for me

foreach (var member in Member.GetAllAsList())
{
    // to get Property
    var property = member.getProperty("danceStyles");

    // to get Property Value
    var propertyValue = member.getProperty("danceStyles").Value;
}
like image 158
Ankur Ghelani Avatar answered Oct 16 '22 09:10

Ankur Ghelani