2

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.

user3248331
  • 105
  • 1
  • 8

1 Answers1

7

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");
Rob Purcell
  • 1,285
  • 1
  • 9
  • 19