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.
Solved! Go to Solution.
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:
Here's GraphUser_V1's structure:
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,
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.
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:
Here's GraphUser_V1's structure:
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,
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.
User | Count |
---|---|
256 | |
106 | |
92 | |
47 | |
37 |