Copied to clipboard

Flag this post as spam?

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


  • xrisdoc 54 posts 102 karma points
    Aug 07, 2012 @ 15:50
    xrisdoc
    0

    Setting Member Property

    I am having a bit of trouble trying to access/edit Umbraco Member properties.

    I have created a property in Umbraco for my members and I can set this fine using the Umbraco Backend.

    However, I am trying to to access/edit these properties within my own code.

        Member umbracoUser = new Member(1077);
        umbracoUser.getProperty("isDisabled").Value = "1";

    When assiging the value to the property I get an error saying

        Object reference not set to an instance of an object.

    I can get access to everything else on the umbracoUser object, such as LoginName and Email etc, but cant get the properties that I have created.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Aug 07, 2012 @ 16:10
    Lee Kelleher
    0

    Hi xrisdoc, welcome to the forum!

    The error would most likely come from the member not having a property with that alias.  Double-check that you have a property called "isDisabled" - it is case-sensitive too.

    Cheers, Lee.

  • xrisdoc 54 posts 102 karma points
    Aug 07, 2012 @ 17:14
    xrisdoc
    0

    Thanks for your reply.

    There is definitely a property called "isDisabled". I have even tried copy and paste just to make sure.

  • xrisdoc 54 posts 102 karma points
    Aug 07, 2012 @ 17:29
    xrisdoc
    0

    Ok, i've just noticed something.

    I am trying to perform this task within a MVC3 application which is a sub application within my umbraco site. I have succesfuly intgrated the Umbraco membership provider and I can use this within my MVC application. But still can't access properties of members as described previously.

    I have just created a user control that I have implemented on my umbraco site (not the sub application) using the exact same code as described earlier. and I am able to access the properties with no problem.

    It is only within the sub appliation that I get this error.

    Thanks,

Please Sign in or register to post replies

Write your reply to:

Draft