cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Office365Users.SearchUser() returned profile not 'compatible' with Office365Users.UserProfileV2() in ComboBox

I am not sure what may have changed recently, however I noticed that my ComboBoxes to select Office365 Users were no longer displaying the DefaultSelectedItem value 'DisplayName' (admittedly they were fickle to begin with).  I checked that the DefaultSelectedItem was in fact returning a record (in the formula result bar), which it was.  The Items property was also returning O365 profile records.

This did not work in the ComboBox properties (Parent.Default is the Id for a O365 user):

Items = If(!IsBlank(Value_PeoplePicker_1.SearchText), Office365Users.SearchUser({searchTerm: Value_PeoplePicker_1.SearchText}))
DefaultSelectedItems = Office365Users.UserProfileV2(Parent.Default)

Both were returning records however there was still no selected item 'displayed' in the ComboBox.

After inspecting the records returned, I noticed that the SearchUser() returned the column names with the first letter capitalised (i.e. DisplayName).  The UserProfileV2 returned the same columns in the record, except the first letter was lower case (i.e. displayName).

This works:
Items = If(!IsBlank(Value_PeoplePicker_1.SearchText), Office365Users.SearchUser({searchTerm: Value_PeoplePicker_1.SearchText}))
DefaultSelectedItems = If(!(IsBlank(Parent.Default)), Office365Users.SearchUser({searchTerm: Office365Users.UserProfileV2(Parent.Default, {'$select': "userPrincipalName"}).userPrincipalName}))

I am surmising that this now works because the DefaultSelectedItems returns a record that is compatible with the Items (i.e. the case of the column names now matches).

Am I missing something?  The 'double hop' to get the DefaultSelectedItems seems very inefficient to me (and conscious of throttling of API calls on the connector).  If the ComboBox is set to select multiple, the numbers of calls would also increase.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Office365Users.SearchUser() returned profile not 'compatible' with Office365Users.UserProfileV2() in ComboBox

Hi @pHozFoRus ,

The reason why you met this problem is that the results of SearchUser function and UserProfileV2 function are different.

The result of SearchUser function is array of user.

While the result of UserProfileV2 function is GraphUser_V1.

Since you have set items about SearchUser function, so the DefaultSelectedItems should be the same structure as  array of user.

Here's user's structure:

1221.PNG

 Here's GraphUser_V1's structure:

1222.PNG

 Please notice that these two kinds of response have many differences, not only displayname's first letter capitalised.

 

So I suggest you consider using the same function as the final result in Items and DefaultSelectedItems.

If you insist in using  Office365Users.SearchUser in Items and using Office365Users.UserProfileV2 in DefaultSelectedItems, here are two ways to solve this problem:

1)use the second formula like you listed 

2)use AddColumns/DropColumns/ShowColumns to shape table

 

To sum up, make results in two properties are of the same structure.

Here's a doc about office365 connector, please refer these two functions' response:

https://docs.microsoft.com/en-us/connectors/office365users/#graphuser_v1

 

 

 

Best regards,

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Frequent Visitor

Re: Office365Users.SearchUser() returned profile not 'compatible' with Office365Users.UserProfileV2() in ComboBox

Hi @v-yutliu-msft - thanks for the reply - it absolutely makes sense the way you have explained the differences.  It has helped and hopefully will leave an artefact for others to find who run across the same issue.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Office365Users.SearchUser() returned profile not 'compatible' with Office365Users.UserProfileV2() in ComboBox

Hi @pHozFoRus ,

The reason why you met this problem is that the results of SearchUser function and UserProfileV2 function are different.

The result of SearchUser function is array of user.

While the result of UserProfileV2 function is GraphUser_V1.

Since you have set items about SearchUser function, so the DefaultSelectedItems should be the same structure as  array of user.

Here's user's structure:

1221.PNG

 Here's GraphUser_V1's structure:

1222.PNG

 Please notice that these two kinds of response have many differences, not only displayname's first letter capitalised.

 

So I suggest you consider using the same function as the final result in Items and DefaultSelectedItems.

If you insist in using  Office365Users.SearchUser in Items and using Office365Users.UserProfileV2 in DefaultSelectedItems, here are two ways to solve this problem:

1)use the second formula like you listed 

2)use AddColumns/DropColumns/ShowColumns to shape table

 

To sum up, make results in two properties are of the same structure.

Here's a doc about office365 connector, please refer these two functions' response:

https://docs.microsoft.com/en-us/connectors/office365users/#graphuser_v1

 

 

 

Best regards,

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Frequent Visitor

Re: Office365Users.SearchUser() returned profile not 'compatible' with Office365Users.UserProfileV2() in ComboBox

Hi @v-yutliu-msft - thanks for the reply - it absolutely makes sense the way you have explained the differences.  It has helped and hopefully will leave an artefact for others to find who run across the same issue.

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,711)