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 Apps / PowerApps - Office365U...
Power Apps
Unanswered

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,099 Super User 2025 Season 2 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,099 Super User 2025 Season 2 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,099 Super User 2025 Season 2 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

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard