Get properties from users in Umbraco (in Usercontrol)

I created the Umbraco website and I got some members that I need to display on the usercontrol (ascx) page. But the only thing I can find is the old umbraco api, using the m.GetProperty(); method m.GetProperty(); :

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

But the visual studio says that Member deprecated, and I should use Membership instead, but I don't know how I can get common properties from a member through this. The only things I can get are Username , Email and Password , not the properties that I define in umbraco ...

+6
source share
2 answers

Yah, Member.GetAll deprecated, but I suppose you could use Member.GetAllAsList() , this method should be to get items in a 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; } 
+2
source

The default properties of an element, such as Login, Email, and Password, can be easily specified via .Net properties, however, as you noticed, custom properties can only be accessed line by line.

The getProperty() method returns an umbraco.cms.businesslogic.property.Property object, so if you want to get / set the actual values ​​of the custom properties that you created, simply access the Value [.net] property in the [umbraco] property, similar to this:

 m.getProperty("danceStyles").Value 
0
source

All Articles