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 / Save Gallery in Sharep...
Power Apps
Suggested Answer

Save Gallery in Sharepoint

(1) ShareShare
ReportReport
Posted on by 151
I would like to save my entire collection in a SharepointList. But I don't want to have to click on every single article for the patch formula, I really just want to click on a button and it then saves everything in a SharepointList. 
I've tried a bit to create a collection and then try to transfer it, but somehow it doesn't work. Is there a way?
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,051 Most Valuable Professional on at
    Can you please share the code (in Text) that you have attempted and the result of this.
  • MiniMax92 Profile Picture
    151 on at
    I try it with:
     
    ForAll(Sharepointlist;Patch(Sharepointlist;{'Ordered Value': Value(TextInput1_2.Text)}))
     
  • WarrenBelz Profile Picture
    156,051 Most Valuable Professional on at
    You are patching it to itself- you cannot do this - you need to Patch the collection
  • MiniMax92 Profile Picture
    151 on at
    Oh my Bad.
    But it isn't still working.
    I Try it with this formular:
     
    Patch(Sharepointlist; Col_fin )
    The error Message: Invalid argument type (table). A record is expected at the moment.
  • WarrenBelz Profile Picture
    156,051 Most Valuable Professional on at
    Can you please tell me exactly what you are trying to do here. Do you want the entire collection to be sent to SharePoint as new records ? If so is every field in the collection also in the list with exactly the same name and data type ?
  • MiniMax92 Profile Picture
    151 on at
    I would like to add articles in my gallery to a SharePoint list at the click of a button. But all articles that are in the gallery. Not just the selected ones.
     
  • MiniMax92 Profile Picture
    151 on at
    I've now tried something again and at least for the first time in Sharepoint, it works. But he doesn't do it for the others, even though "ForAll" is supposed to apply that to the gallery.
     
    ForAll( Gallery1.AllItems; Patch(SP_List;
    LookUp( Gallery1.AllItems; ID = ThisRecord.ID; ThisRecord )
    
     ; { Abschluss: "Ja" } ))
     
    Don't understand why it doesn't apply to every record in the gallery. 
  • Ram Prakash Duraisamy Profile Picture
    5,877 Super User 2026 Season 1 on at
    Hi,
     
    There are 2 ways we can achieve this
     
    1. Send Values from Canvas App to Power Automate
     
    // Define the collection variable
    ClearCollect(GalleryItems, Gallery.AllItems);
    
    // Convert collection to JSON
    Set(jsonData, JSON(GalleryItems, JSONFormat.IncludeBinaryData));
    
    // Run the flow
    YourFlow.Run(jsonData);
     
    2. Use below code to save to SP
     
    ForAll(
        MyCollection,
        Patch(
            TEST, 
            Defaults(TEST),
            {
                Name: ThisRecord.Name,
                Title: ThisRecord.Title
            }
        )
    );
     
     
    Follow me for Move videos : https://www.youtube.com/@rampprakash3991
     
     
     
  • MiniMax92 Profile Picture
    151 on at
    Ok, that almost worked. I now have the problem that it creates a new data set in SharePoint every time and does not update the existing one. This is my formula:
     
    ForAll(
        Gallery1.AllItems;
        Patch(
            SP_List ;
            Defaults(SP_List)
    
     ; { Abschluss: "Ja" } ))
     
  • rzuber Profile Picture
    552 Moderator on at
    Something like this might work
    ForAll(
        Gallery1.AllItems As _article;
        With(
            {
                _record: If(
                    IsBlank(LookUp(SP_List; ID=_article.ID));
                    Defaults(SP_List);
                    LookUp(SP_List; ID=_article.ID)
                )
            };
            Patch(
                SP_List;
                _record;
                _article
            )
        )
    )
     
     

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#2
11manish Profile Picture

11manish 192

#3
Valantis Profile Picture

Valantis 128

Last 30 days Overall leaderboard