web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add users from source ...
Power Apps
Unanswered

Add users from source Table to collection

(0) ShareShare
ReportReport
Posted on by 2

Hi,

 

I like to add the current user to a list in the collection.

When opening the app (screen1, onvisible) I collect the current user:

 

ClearCollect(
 colMembersToAdd,
 ForAll(
 Filter(
 OpSPLijst,
 Id = Gallery1.Selected.Id
 ),
 {
 Attendees: {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
 Claims: "i:0#.f|membership|" & Lower(User().Email),
 Department: "",
 DisplayName: User().FullName,
 Email: User().Email,
 JobTitle: "",
 Picture: ""
 }
 }
 )
)

 

However, when clicking a button from a gallery, I want to add the current users for that record in the collection. These are coming from a table in sharepoint: "OpSPLijst".

How can I add these users to the existing collection. In addition, how can i patch the collection with all the users back to the table?
Current code for button:

 

Collect(
 colMembersToAdd.Attendees,
 ForAll(
 Filter(
 OpSPLijst,
 Id = Gallery1.Selected.Id
 ),
 {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
 Claims: Namen.Claims,
 Department: Namen.Department,
 DisplayName: Namen.DisplayName,
 Email: Namen.Email,
 JobTitle: Namen.JobTitle,
 Picture: Namen.Picture
 }
 )
);

 


The collection is not updated. I only see the current user in the collection.

Thank you

Categories:
  • Krishna92 Profile Picture
    Microsoft Employee on at

    @vanachterj 

     

    From the formula that you have shared below I don't see the patch function which is trying to update a single column value in the share point.

     

    You can access the below mentioned link to see information related to patch function and you can implement it on the button code where you are trying to update information to see right values getting updated in the columns

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

     

    If this information helps you, please hit the like button and mark the solution as resolved, so that it will help other users in future.

  • vanachterj Profile Picture
    2 on at

    I've managed to update the process because the items were grouped. 
    When you click on the button for these collections are made:

    ClearCollect(
     colMembersToAdd,
     ForAll(
     Filter(
     OpSPLijst,
     Id = Gallery1.Selected.Id
     ),
     {
     
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Claims: "i:0#.f|membership|" & Lower(User().Email),
     Department: "",
     DisplayName: User().FullName,
     Email: User().Email,
     JobTitle: "",
     Picture: ""
     
     }
     )
    );
    
    ClearCollect(
     test,
     ForAll(
     Filter(
     OpSPLijst,
     Id = Gallery1.Selected.Id
     ),
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Claims: Namen.Claims,
     Department: Namen.Department,
     DisplayName: Namen.DisplayName,
     Email: Namen.Email,
     JobTitle: Namen.JobTitle,
     Picture: Namen.Picture
     }
     )
    );
    
    ClearCollect(test2,Ungroup(test,"Email"));
    
    Collect(colMembersToAdd, ForAll(test2, {Email: Email}))

    Which results in this:
    image.png

    So I have a list of already existing fields coming from the Sharepoint list (2 last rows) and the current user info (1st row).
    So now I have to patch all these rows back in the Sharepoint list field '. 

    That's something i'm stuck on at this moment:

    If(
    	IsEmpty(
    		Errors(OpSPLijst,
    			Patch(
    				OpSPLijst,
    				First(
    					Filter(
    						OpSPLijst,
    						Id = Gallery1.Selected.Id
    					)
    				),
    				{
    					 Namen: ForAll(colMembersToAdd,{
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    						Claims:"",
    						Department:"",
    						DisplayName:"",
    						Email:"",
    						JobTitle:"",
    						Picture:""
    					}),
    					Aanwezigen: CountRows(Gallery1.Selected.Namen) + 1,
    					Email:User().Email & "; "
    				}
    			)
    		)
    	)
    	, Notify("Inschrijving voltooid",NotificationType.Success),
     Notify("Er is iets misgelopen",NotificationType.Error)
    )




Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard