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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApps - Office365U...
Power Apps
Answered

PowerApps - Office365Users.DirectReports

(1) ShareShare
ReportReport
Posted on by 29
I'm encountering an issue with the Office365Users.DirectReports function in my application. The error message states: "office365users.directreports failed: the function 'directreports' has an invalid value for parameter 'userid' - a blank value was passed to it where it was not expected. Please make sure that a valid argument is passed to the function."

To provide some context, I'm using a text field where the manager's email is entered, and the Office365Users.DirectReports function should return the direct reports

 

(Office365Users.DirectReports(Head_Department_Name.Value))

 

. The application runs fine, but this error appears during data loading, and I need to hide this notification.

Could anyone advise on how to prevent this error or hide the notification?

Thanks in advance for your help!

I tried to modify the following code but without success: 

 

If (!IsBlank(ThisItem.CreatedByUser), Office365Users.UserProfile(ThisItem.CreatedByUser).DisplayName)

 

Categories:
I have the same question (0)
  • Verified answer
    Daniel Bocklandt Profile Picture
    5,151 Super User 2026 Season 1 on at

    Hey @LukasToman ,

     

    You can do it like this :

     

    IfError(Office365Users.DirectReports(Head_Department_Name.Value),"")

    This will hide the error message. 

     

     

  • LukasToman Profile Picture
    29 on at

    Does'nt work 😞 

    LukasToman_0-1721035127130.png

     

  • Daniel Bocklandt Profile Picture
    5,151 Super User 2026 Season 1 on at

    What is the error that it shows?

     

  • LukasToman Profile Picture
    29 on at

    LukasToman_0-1721038445739.png

     

  • LukasToman Profile Picture
    29 on at

    The expression was intended to retrieve the direct reports of the user whose department name is stored in the variable 'Head_Department_Name', and if there is an error, return an empty string. However, the errors indicate that the 'DirectReports' function is expecting a table value as an argument, not a text value, and the arguments provided to the 'IfError' function are invalid.

  • Daniel Bocklandt Profile Picture
    5,151 Super User 2026 Season 1 on at

    I just took a look at the connector: 

    IfError(Collect(colReports,Office365Users.DirectReportsV2(Head_Department_Name.Value)),"")

    This code needs to be on a button (Navigate to the next screen or something like this) or on the onChange of your DroDown/Combobox.  Make sure to use the new version of the action and put colReports in the control requested. 

     

     

  • LukasToman Profile Picture
    29 on at

    Problem solved... thanks to your idea .... with small modify .... i set IfError to App > OnError adn now working 🙂 thanks

    LukasToman_0-1721039077778.png

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,070

#2
Valantis Profile Picture

Valantis 639

#3
11manish Profile Picture

11manish 608

Last 30 days Overall leaderboard