Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Error message

(0) ShareShare
ReportReport
Posted on by 199

hi. I have a customized form. When the user opens the form on sharepoint, it would extract users details. 

 

I used this code for the managers hierarchy

Office365Users.ManagerV2(User().Email).mail - user manager

Office365Users.ManagerV2(Office365Users.ManagerV2(User().Email).mail).mail - manager of the users manager

Office365Users.ManagerV2(Office365Users.ManagerV2(Office365Users.ManagerV2(User().Email).mail).mail).mail - etc

 

It works. But one user have this error message and it doesnt work for him, im not quite sure why.

batmanMon_0-1674721072923.png

 

  • batmanMon Profile Picture
    199 on at
    Re: Error message

    @BCBuizer it worked! Thank you so much!

  • Verified answer
    BCBuizer Profile Picture
    22,027 Super User 2025 Season 1 on at
    Re: Error message

    Hi @batmanMon ,

     

    Instead of using User().Email you may opt to use Office365Users.MyProfileV2().userPrincipalName

  • BCBuizer Profile Picture
    22,027 Super User 2025 Season 1 on at
    Re: Error message

    Hi @batmanMon ,

     

    Instead of using User().Email you may opt to use Office365Users.MyProfileV2().userPrincipalName

  • batmanMon Profile Picture
    199 on at
    Re: Error message

    I know now what was wrong. It appears that the user has two email addresses. I dont know how to go around it in smart way, so i hardcoded Bobs email addresses in if statement

  • batmanMon Profile Picture
    199 on at
    Re: Error message

    The weird thing is, if I put a text label and type this specific users email address(lets call him Bob). then I inserted a second label with Office365Users.ManagerV2(Label2.Text).mail. it works, it recognizes Bobs manager.

    The form doesnt recognize Bobs office365 details, when he opens the app himself. It works perfect for any other user

    batmanMon_0-1674724890222.png

     

  • batmanMon Profile Picture
    199 on at
    Re: Error message

    @BCBuizer thank you for your reply. The user works for the same manager for a couple of years now 😞 i dont know why he is the only one whos got this error message.

  • BCBuizer Profile Picture
    22,027 Super User 2025 Season 1 on at
    Re: Error message

    Hi @batmanMon ,

     

    Perhaps someone's manager hasn't been set. This will cause the ManagerV2 function to return an error.

     

    I advise to add some error handling in your code, for instance with the IfError function: https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-iferror

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,011 Most Valuable Professional

Leaderboard