Search code examples
bulkoffice365connectorspowerapps-collection

Power Apps Collection: How to access nested table items from collection?


What I am trying to do is paste a list of user IDs, and resolve the list to the people and then save their info to a collection and eventually write them to SharePoint.

I have a multiline text input control (txtPastedText) that accepts a pasted line-delimited list of IDs which are also listed in Office365 as MailNickname. Then I have a Button that executes a ForAll to add them to a collection (UserIDList), but the collection creates a table with two columns: @odata.nextLink and value which is a table. How do I iterate through the collection to get data from each user, like DisplayName and then put that into another collection.

txtPastedText

ABC1234
FGH3456
GHI4598

Button OnSelect = ClearCollect(UserIDList,ForAll(Split(txtPastedText.Text, Char(10)),Office365Users.SearchUserV2({searchTerm:ThisRecord.Value})))

Collection contents After Clicking table


Solution

  • The AddColumns and DropColumns functions come to your rescue. Using this pattern you could get whatever data you want from the results:

    DropColumns,
        AddColumns(O365UResults,
            "Email", value.Email,
            "DisplayName", value.DisplayName,
            ...
        ),
        "@odata.nextLink","value"
    )