Copied to clipboard

Flag this post as spam?

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


  • Anders Brohäll 295 posts 561 karma points MVP c-trib
    Jun 23, 2014 @ 12:10
    Anders Brohäll
    0

    Getting email from TypedMember

    Hi,

    I can't figure out how to fetch the built in email address from a TypedMember. When using dynamics, member.email works fine. However, i can't find any data in the property called email in the typed object. Is it called something else?

    http://our.umbraco.org/documentation/Reference/Querying/UmbracoHelper/ doesn't really help out : /

  • Dan Lister 416 posts 1974 karma points c-trib
    Jun 26, 2014 @ 12:29
    Dan Lister
    0

    Hi Anders,

    Have you tried using the GetPropertyValue method like as follows:

    @Umbraco.TypedMember(id).GetPropertyValue("email");

    Thanks,
    Dan. 

  • Anders Brohäll 295 posts 561 karma points MVP c-trib
    Jun 26, 2014 @ 15:51
    Anders Brohäll
    0

    To be honest, no. But i did try:

    @Umbraco.TypedMember(id).GetPropertyValue<string>("email");
    

    ...that returns an empty string.

  • Asbjørn 82 posts 195 karma points c-trib
    Aug 25, 2014 @ 20:01
    Asbjørn
    0

    Did you ever find a solution? I'm facing a similar issue trying to get the user name. If no solution has been found, I think a bug should be filed.

  • Anders Brohäll 295 posts 561 karma points MVP c-trib
    Aug 25, 2014 @ 20:03
    Anders Brohäll
    0

    Nah, no solution. Worked around it with the dynamic object instead.

  • Sören Deger 733 posts 2844 karma points c-trib
    Mar 31, 2015 @ 06:27
    Sören Deger
    0

    Hi all,

    Is there already a solution for this? Currently I have the same problem with TypedMember and getting the email address.

     

    Best,

    Sören

  • Simon Dingley 1474 posts 3451 karma points c-trib
    May 10, 2015 @ 12:22
    Simon Dingley
    0

    I have found the same limitation in v6.2.5 and the only way I could work around it was like Anders to use the dynamic object by changing:

    var member = Umbraco.TypedMember(id)
    

    to

    var member = Umbraco.Member(id)
    

    Then access it via member.Email

    Not ideal but I couldn't see anyway around it right now?

    Simon

  • Shannon Deminick 1530 posts 5278 karma points MVP 4x
    Aug 05, 2015 @ 16:40
    Shannon Deminick
    1

    Use the case "Email" instead of "email" and it will work.

  • Shannon Deminick 1530 posts 5278 karma points MVP 4x
    Aug 05, 2015 @ 16:40
  • Anders Bjerner 487 posts 2996 karma points MVP 9x admin c-trib
    Aug 05, 2015 @ 17:30
    Anders Bjerner
    1

    If you're just calling Umbraco.TypedMember(1234) you get a reference to the member as IPublishedContent.

    If you cast the member to MemberPublishedContent, you can access Email and other member related properties.

    Here is a quick example:

    @{
    
        MemberPublishedContent member = Umbraco.TypedMember(1234) as MemberPublishedContent;
    
        if (member != null) {
            <p>Username: @member.UserName</p>
            <p>Email: @member.Email</p>
        }
    
    }
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies