Skip to main content
Community site session details

Community site session details

Session Id : iMoWf+qzF/XTmp9APgiSxr
Power Apps - Building Power Apps
Answered

The method 'ManagerV2' has an invalid value for parameter 'id'

Like (0) ShareShare
ReportReport
Posted on 28 Nov 2019 05:06:41 by 186

Hi

 

I am customising a SharePoint form using PowerApps. The column Requester Name is of type Person / Group, users can look up users in Azure AD. Based on this field other fields are populated and written to the SharePoint list on submit, including:

  • the looked up user's job title
  • the looked up user's manager
  • the looked up user's manager's job title

Sometimes, the selected user will not have some or all of the above properties.

image.png

 

This is the code I have written:

Default property on Manager Name DataCardValue

If(
 !IsEmpty(DataCardValue15.Selected),
 Office365Users.ManagerV2(DataCardValue15.Selected.Email).displayName
)

 

Similar code is executed on the Text and Default property on the DataCardValues of Requester Title and Manager Title.

 

What I was expecting:

If a user is selected in Requester Name, return and display information about them/their manager.

 

What actually happened:

 

Scenario 1

A user has not been selected, the following error message is displayed:

Office365Users.UserProfileV2 failed: The method 'UserProfileV2' has an invalid value for parameter 'id'

 

I am not sure why this is happening since the condition of a user being selected is not being met, therefore the second part should not run.

 

Scenario 2

A user has been selected but the AD object is missing some information and is displaying the below error:

Office365Users.ManagerV2 failed: {
 "error": {
 "code": "Request_ResourceNotFound",
 "message": "Resource 'manager' does not exist or one of its queried reference-property objects are not present.",
 "innerError": {
 "request-id": "20a0f2e1-52e7-4e83-a1e8-6b13dfdc09c5",
 "date": "2019-11-28T04:54:33"
 }
 }
}

 

I am not catching this error, so this is okay. Does anyone know of a way to catch this error?

 

How do I return information about a user that is selected dynamically and how do I handle errors if no/the wrong information is returned? Am I on the right track here? Any help would be appreciated!

Categories:
  • Bruno_Lanzoni Profile Picture
    5 on 25 Oct 2023 at 13:17:18
    Re: The method 'ManagerV2' has an invalid value for parameter 'id'

    Very good ! Solved it for me

  • shopp Profile Picture
    8 on 24 Feb 2023 at 19:19:08
    Re: The method 'ManagerV2' has an invalid value for parameter 'id'

    I've been researching this issue for months and your solution worked for me!  The feature is now in upcoming Features and out of Experimental, but it did the trick!!  I was trying to use manager in a gallery for a staff directory and now, no errors!! Thanks so much.

  • Community Power Platform Member Profile Picture
    on 09 Feb 2023 at 20:10:10
    Re: The method 'ManagerV2' has an invalid value for parameter 'id'

    I think you could be partially right about the error being because of an empty manager, but I received the error even if the user I entered (me, as

     

    User().Email

     

    ) had a manager. So I think it appeared because I was mixing "Manager" & "ManagerV2". I had the right case for the properties I was using ("Manager" requires capitals for the property names, "ManagerV2" requires lowercase), but it didn't matter - I think it got hung up because I filled with a combination of them instead of strictly just using one or the other. Here is the one with the error:

     

    If(SharePointForm1.Mode=FormMode.New && Not( gvCurrentManager.userPrincipalName = ""),{
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     DisplayName: Office365Users.ManagerV2(User().Email).displayName,
     Claims: "i:0#.f|membership|" & Lower(Office365Users.ManagerV2(User().Email).mail),
     Department: "",
     Email: Office365Users.Manager(User().Email).Mail
    },Parent.Default)

     

    where gvCurrentManager was filled with 

     

    Office365Users.ManagerV2(DataCardValue2.Selected.Email)

     

     

    Instead of this combination, where it worked and I got rid of the error:

     

    If(SharePointForm1.Mode=FormMode.New && Not( gvCurrentManager.UserPrincipalName = ""),{
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     DisplayName: Office365Users.Manager(User().Email).DisplayName,
     Claims: "i:0#.f|membership|" & Lower(Office365Users.Manager(User().Email).Mail),
     Department: "",
     Email: Office365Users.Manager(User().Email).Mail
    },Parent.Default)

     

    and gvCurrentManager was filled with 

     

    Office365Users.Manager(DataCardValue2.Selected.Email))

     

     

    So either something is wrong with "ManagerV2", or you just can't mix the two.

  • Community Power Platform Member Profile Picture
    on 05 Feb 2022 at 18:26:30
    Re: The method 'ManagerV2' has an invalid value for parameter 'id'

    Don't panic!

    Simple Enable this:
    Go to
    «Experimental features section» -> Enable «Formula-level error management»

    and Use this Formula: IfError(Office365Users.ManagerV2(User().Email).displayName;"");

    was glad to help 😊

  • Verified answer
    yashag2255 Profile Picture
    24,669 Super User 2024 Season 1 on 28 Nov 2019 at 11:24:03
    Re: The method 'ManagerV2' has an invalid value for parameter 'id'

    Hey @LKS 

     

    This seems to be a limitation of Office365 users when a manager does not exist for the employee. The data in AAD needs to be correct and appropriate for all the users to work with this case. Though you can apply some kind of exclusion for employees who do not have managers like: https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Office365Users-Manager-throws-error-when-CEO-has-no-manager/td-p/36183 

    While to make this work for the employees that have manager details stored, please update the default property of the data-cards as:

    Employee Title:

    If(
    !IsEmpty(DataCardValue15.Selected),
    Office365Users.UserProfileV2(DataCardValue15.Selected.Email).jobTitle
    )


    Manager Name:

    If(
    !IsBlank(DataCardValue15.Selected.Email),Office365Users.ManagerV2(DataCardValue15.Selected.Email).displayName)


    Manager Title:

    If(
    !IsBlank(DataCardValue15.Selected.Email),Office365Users.ManagerV2(DataCardValue15.Selected.Email).jobTitle)

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete