umbracomembermultiple-choicecustomproperty

umbraco how to update multiple prevalue programatically


I have a member type which has a custom property - lets name it books - of data type checkbox - so multiple choice is possible.

Now I'm trying to update this member programatically with new values for books. In the customxml it comes as cdata, I'm passing a value as

umbraco.cms.businesslogic.member.Member member =  umbraco.cms.businesslogic.member.Member.GetMemberFromEmail(email);
member.SetProperty("memberBooks", booksValue);
member.Save();

where 'booksValue' is a string of values seperated with comma - because it's how it appears in the contentXml.

It doesn't work.

The question is - how do I update the member property/ xml with new multiple values?


Solution

  • here is what you need to do:

    umbraco.cms.businesslogic.member.Member member = umbraco.cms.businesslogic.member.Member.GetMemberFromEmail(email);
    member.getProperty(“memberBooks”).Value = booksValue;
    member.Save();
    

    I hope this should work. I haven't tried it since long-time but this is how I used it.