cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Community Support
Community Support

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

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
Community Support
Community Support

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

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
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

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