Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • mlu 12 posts 74 karma points
    Feb 27, 2014 @ 15:15
    mlu
    0

    Set Member Media Property

    Hi.

    We need to set pictures for members from a different source. So we decided to add an external interface where you can set member properties.

    Set a normal string property is now easy. But seting a media is difficult.

    media = Umbraco.Core.Models.Media  //type
    
                var objProperty = _member.GenericProperties.SingleOrDefault(p => p.PropertyType.Alias == propertyAlias);
    
            if (objProperty == null)
                return false;
    
            objProperty.Value = media;
            _member.getProperty(propertyAlias).Value = media;
    
            _member.Save();
            _member.XmlGenerate(new XmlDocument());
    

    I cannot figure out what should be wrong :-(

Please Sign in or register to post replies

Write your reply to:

Draft