web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Query regarding retrie...
Power Pages
Unanswered

Query regarding retrieving current user email in Power Pages with local authentication.

(0) ShareShare
ReportReport
Posted on by 49

While accessing a power page (site), we do perform local Microsoft authentication. Like every user, when entering the site's URL, it goes through Single Sign-On (SSO) and routes to the power page. Is there any way to retrieve the user's email ID in power pages? In Power Apps, we can obtain the user's email using 'User().Email'. Is there a similar method to retrieve the current user in power pages?. 

 

FYI., we don't have azure subscription. 

 

I have used the below Logic, i get "Hello, anonymous user"

 

```

    {% if user %}
    Hello, {{ user.fullname | escape }}!
    {% else %}
    Hello, anonymous user!
    {% endif %}
```
Categories:
I have the same question (0)
  • Lucas001 Profile Picture
    2,429 Super User 2025 Season 2 on at

    Hi @eswarcareless,

     

    unfortunately the email is not easily possible.

    You can use the id or the fullname as you already do:

     

    <p id="userName">{{ user.fullname }}</p>
    <p id="userId">{{ user.contactid }}</p>

     

    What I do to send a message is the following:

    {% assign userRoles = user.roles %}
    {% for roleItem in userRoles %}
     {% if roleItem == 'RoleWhichYouWantToCheck' %}
     <p id="message" style="display: none">YourMessage<p>
     {% endif %}
    {% endfor %}

    That way you can display a message if the user is anonymous or authenticated.

    I use that code snippet for a custom role and display a message afterwards.

     

    Hope that helps. Please mark the post as a solution if it solves your problem or consider a thumbs up when it helps.

     

  • Verified answer
    Saud Ali Profile Picture
    812 Super User 2024 Season 1 on at

    Hi @eswarcareless ,

     

    The simple answer is NO, you cannot get it in Power Pages using user object.

     

    Thanks,

    Saud

     

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Fubar Profile Picture
    8,338 Super User 2025 Season 2 on at

    If the email address is stored in Dataverse (which it would be if you are using Local Authentication or Claims mapping is configured correctly for External Identity providers then it is available via Liquid.

     

    The Liquid 'user' object is the Dataverse Contact record, when a user is logged into the portal the 'user' object will exist and all the contact fields are available (except field types that are not supported b the portal).

     

    As an example (note: in the designer it will not populate the value, only when you are logged into the site e.g. via preview, if you are not logged into the site you will get the anonymous user message)

    {% if user %}
     Hello, {{ user.fullname | escape }}!<br>
     {{ user.emailaddress1 }} 
     {% else %}
     Hello, anonymous user!
    {% endif %}

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard