Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have extended the Member in BackOffice to have a Nested Content object on it called badges. Basically a logged in user can do things on the website to unlock/earn badges.
I have an UmbracoAPIController handling the call from the front end which looks as shown
public IContent IsNewBadge(int newSteps)
var contentService = ApplicationContext.Services.ContentService;
var memberService = ApplicationContext.Current.Services.MemberService;
// all available badges
var allBadges = contentService.GetById(1144).Children();
var secMember = Membership.GetUser();
if (secMember != null)
var currentMember = memberService.GetByUsername(secMember.UserName);
// Get all badges this member currently has - or return a new empty list if null
var allMemberBadges = currentMember.GetValue<List<IContent>>("badges") ?? new List<IContent>();
foreach (var badge in allBadges)
// check if the passed in number meets or exceeds a badge's required number
if (newSteps >= badge.GetValue<int>("badgeStepsRequired"))
// if the badge is not already in the list
currentMember.SetValue("badges", new List<IContent>(allMemberBadges));
My question is specifically around the "SetValue" method. Is this even the correct method that I should be using? It seems to only want (string,string) or (string,filestream).
The error that I get is
"Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'The best overloaded method match for 'Umbraco.Core.Models.ContentBase.SetPropertyValue(string, string)' has some invalid arguments'"
"The best overloaded method match for 'Umbraco.Core.Models.ContentBase.SetPropertyValue(string, string)' has some invalid arguments"
How can I update my custom member property via API?
Thanks for any suggestions!
Yes, this is the right method - "SetValue"
I think in this row you need to convert List to string, serialize the list to JSON for example.
currentMember.SetValue("badges", new List<IContent>(allMemberBadges))
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted