Power Automate create an Object and append to an Array using Apply to each loop | Get SharePoint groups and their permission levels

 In this demonstration, I am giving an insights of have apply to each loop, I want to create an dynamic array.

I have Rest API url getting SharePoint groups and their permission levels in an array which is used to assign to a collection in Power Apps.

Using power automate, first I need to call Rest API service

Send HTTP Request to SP.

GET

/_api/Web/RoleAssignments?$expand=Member,RoleDefinitionBindings


Parse JSON for our convince.


I have created an Array: SPGroupPermissionArray variable

I have created an Object SPGroupWithPermissionLevel varaible with value as 

{

"PermissionLevelID":"",

"PermissionLevelName":""

}

Apply to each loop

to output of Parse JSON

body(parse_json)

Now I have to set the variables SPGroupWithPermissionLevel Object


items('Apply_to_each_2')?['RoleDefinitionBindings']?['results'][0]?['Id']
items('Apply_to_each_2')?['RoleDefinitionBindings']?['results'][0]?['Name']




We See output as


































Comments

Popular posts from this blog

Powerapps overcome 2000 item limit from any datasource

PowerApps multiselect cascading dropdown and save an item to SharePoint List

Multi select cascading dropdown in Power Apps