I'm trying to retrieve membership properties using the imember service in Umbraco 7.4, while i can grab the member object i can't see how to call the custom property values. See example below.
// gets the member object successfully
var member = ApplicationContext.Current.Services.MemberService.GetByUsername("myusername");
member.GetProperty("position"); //not sure how to call this property correctly
I can access this property using the old way see code below, but would like to do it correctly.
Member m = Member.GetMemberFromEmail("myEmail@hotmail.com");
var Posit = m.getProperty("position").Value;
Any assistance would be greatly appreciated.
ps i'm sure it's in the umbraco documentation, i just couldn't find where.
You should be able to access properties of the member using the GetValue<T>
method as follows:
var member = ApplicationContext.Current.Services.MemberService.GetByUsername("myusername");
var position = member.GetValue<string>("position");