Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

add image in a culomn in sharepoint list using powerapps

(0) ShareShare
ReportReport
Posted on by 12

i'm making a powerapps and i have gallery in my page will patch its data in share point list .

 

my problem with the gallery :

 

in the gallery i have same text fields , one of them is attachment to add picture , also have buttons like add button , edit and delete .

add button to add the record to the collection and open another record to fill it .

 

now in the gallery the attached picture when i fill the record each record will have its own picture but after i finished all filling of the page and submit the form and patch the gallery data , the attachments of the records have the same first picture or attachment of the same record .

 

so i put this code in the add button of the gallery :

 

If(

!IsBlank(VisitorName_Textbox_1.Text) &&

!IsBlank(Nationality_Textbox_1.Text) &&

!IsBlank(DocumentType_Textbox_1.Text) &&

!IsBlank(QidPassportNumber_Textbox_1.Text),

 

// Calculate the total days for the visitor in the same month and year

If(

Sum(

ClearCollect(

colVisitorsFoCalculation,

ShowColumns(

Filter(

Visitors,

EmpEmail = DataCardValue12.Text &&

VisitorName = VisitorName_Textbox_1.Text &&

FromDate >= Date(Year(DataCardValue18.SelectedDate), Month(DataCardValue18.SelectedDate), 1) &&

FromDate < Date(Year(DataCardValue18.SelectedDate), Month(DataCardValue18.SelectedDate) + 1, 1)

),

TotalDays

)

),

TotalDays

) + Value(DataCardValue21.Text)<= 6, // Check if total days are less than or equal to 6

 

// Patch data if the visitor has not exceeded the limit

Patch(

colVisitors,

ThisItem, // Reference the current item in the collection

{

RequestID: RequestIDVar,

VisitorName: VisitorName_Textbox_1.Text,

Nationality: Nationality_Textbox_1.Text,

DocumentType: DocumentType_Textbox_1.Text,

QidPassportNumber: QidPassportNumber_Textbox_1.Text,

Attachment: AddMediaButton1_1.Media,

AttachmentName: AddMediaButton1_1.FileName,

ViewMode: true // Switch to view mode after adding

}

);

 

// Add a new empty row to the collection for a new entry

Collect(

colVisitors,

{

VisitorName: "", // Empty VisitorName

Nationality: "", // Empty Nationality

DocumentType: "", // Empty DocumentType

QidPassportNumber: "", // Empty QidPassportNumber

Attachment: "", // Empty Attachment

AttachmentName:"", // Empty AttachmentFileName

ViewMode: false, // Allow editing for the new row

EditMode: false // Disable editing for new entry

}

),

 

// If the condition is not met, show an error notification

 

Set(varTotalDaysPopup, true)

),

 

// If required fields are blank, show a notification

Notify("Please fill all the required fields before submitting.", NotificationType.Error)

);

and put this code in the final submit button to add all of my data to the sharepoint :

 

 
Set(varShowPopup, false);
Set(varFromDate, DataCardValue18.SelectedDate);
Set(varToDate, DataCardValue19.SelectedDate);
Set(varDate, DataCardValue16.SelectedDate);
Set(varEmpEmail, DataCardValue12.Text);
Set(varTotalDay, DataCardValue21.Text);
 
// Submit the form to the first list
SubmitForm(Form1);
 
// Patch only fully filled records to the Visitors list
ForAll(
    Filter(
        colVisitors,
        !IsBlank(VisitorName) && !IsBlank(Nationality) && !IsBlank(DocumentType) && !IsBlank(QidPassportNumber)  // Add more checks if needed
    ),
    Patch(
        Visitors,
        Defaults(Visitors),
        {
            RequestID: RequestIDVar,
            VisitorName: ThisRecord.VisitorName,  
            Nationality: ThisRecord.Nationality,
            DocumentType: ThisRecord.DocumentType,
            QidPassportNumber: ThisRecord.QidPassportNumber,
            Attachment: UploadedImage1_1.Image,
            FromDate:varFromDate,
            ToDate:varToDate,
            EmpEmail:varEmpEmail,
            Date:varDate,
            TotalDays:varTotalDay
        }
    )
);
 
// Show success alert popup
Set(varShowAlirtPopup, true);

i think we have to do a flow to put the image in the sharepoint list and passing the attachment,attachmentfilename as an input , and call the flow in the submit button code

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Categories:
  • Suggested answer
    Nandit Profile Picture
    1,563 Super User 2025 Season 1 on at
    add image in a culomn in sharepoint list using powerapps
     
    In simple terms, can we say that yo are trying to collect the changes / new entries into a collection from a gallery? Then patching all the complete records to SharePoint?
     
    I have tried to replicate what you are doing, I have created a gallery with Collection as Items, a button to add a blank row to collection, Add Media button to get the image from User, and a Patch button to add the images to SharePoint list image column.
    Here's how it looks:
    The AddMediaButton is a Composite control, so we will be referencing the "UploadedImage1" in our Patch statement
    Patch button references this image instead of the AddMediaButton:
    ForAll(
        Gallery1.AllItems As Item,
        Patch(
            Test,
            Defaults(Test),
            {
                image: Item.UploadedImage1.Image
            }
        )
    )
     
    Here's how all three images then get uploaded to the list:
     
    Hope this helps. 
     
    Kind regards, 
    Nandit
     
    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!
     
  • AbdulraofMattur Profile Picture
    12 on at
    add image in a culomn in sharepoint list using powerapps
    in my scroll page in power apps there is form and gallery .
     
    and my work that i need is in the gallery not in the form .
  • WarrenBelz Profile Picture
    146,670 Most Valuable Professional on at
    add image in a culomn in sharepoint list using powerapps
    I will answer your long post with a short answer - you cannot Patch an Attachment file directly from Power Apps other than with FileName.Updates with the file/s in an attachment control. This is due to the format that attachments are stored in Power Apps, which require either an attachment control or a Flow (this blog of mine should give you a start on the process).
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard