Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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)

 

  • LukasToman Profile Picture
    29 on at
    Re: PowerApps - Office365Users.DirectReports

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

    LukasToman_0-1721039077778.png

     

  • DBO_DV Profile Picture
    4,534 Super User 2025 Season 1 on at
    Re: PowerApps - Office365Users.DirectReports

    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
    Re: PowerApps - Office365Users.DirectReports

    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.

  • LukasToman Profile Picture
    29 on at
    Re: PowerApps - Office365Users.DirectReports

    LukasToman_0-1721038445739.png

     

  • DBO_DV Profile Picture
    4,534 Super User 2025 Season 1 on at
    Re: PowerApps - Office365Users.DirectReports

    What is the error that it shows?

     

  • LukasToman Profile Picture
    29 on at
    Re: PowerApps - Office365Users.DirectReports

    Does'nt work 😞 

    LukasToman_0-1721035127130.png

     

  • Verified answer
    DBO_DV Profile Picture
    4,534 Super User 2025 Season 1 on at
    Re: PowerApps - Office365Users.DirectReports

    Hey @LukasToman ,

     

    You can do it like this :

     

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

    This will hide the error message. 

     

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard