Hello,
I'm bravely writing my first umbraco user control (umbraco.tv video was a great help) which will eventually be a member search.
I'm able to fetch all the members and some of their built-in values like Email, but I can't figure out how to use the getProperty method to get a custom member field. Seems like it should be easy from googling examples, but i get an 'Object reference not set to an instance of an object' error with this code:
Code:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ResultsField.Text = "Type above and go";
}
foreach (umbraco.cms.businesslogic.member.Member m in
umbraco.cms.businesslogic.member.Member.GetAll)
{
ResultsField.Text += m.getProperty("RegionServed").Value; // throws the error
ResultsField.Text += m.Email; // works fine
}
}
I'm sure 'RegionServed' is the correct alias of my Member property.
Any ideas? Be nice, I'm a former PHP coder and so far C# is a cruel mistress :)