0

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

U53R777
  • 3
  • 2

1 Answers1

0

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"
)
mmikesy90
  • 783
  • 1
  • 4
  • 11
  • Thanks so much! I ended up using the below code in a button to create a new collection without sub tables `ClearCollect(IDList,AddColumns(UserIDList,"Email",First(value).Mail,"DisplayName",First(value).DisplayName))` – U53R777 Aug 15 '23 at 20:10