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 / How do I overwrite a S...
Power Apps
Answered

How do I overwrite a Sharepoint list item of the same title? Binary Image Patch.

(0) ShareShare
ReportReport
Posted on by 221

Thank you in advance for your coding knowledge!

 

How would my patch function look if it were told to replace a Sharepoint list item if an item of the same Title already exists? I want users to be able to update an item image by overwriting the existing same-Titled list item.

 

To provide more detail, with my current coding Sharepoint makes multiple rows of the same Titled item if multiple images are patched from the same item-edit screen. This is a problem because (shown below) my lookup specifically needs these Titles to be unique and specific. I cannot force the Title column in the image below to be unique via Sharepoint list settings because the Title is the item ID that  matched my item other data in a SQL table.

 

chrome_Pe9HNWeAMy.png

 

I use the below function to patch in my images to a Sharepoint list: DataCardValue51.Text is the corresponding row ID from the SQL table that holds the rest of the items data. Thus making the linking connection to the correct image.

 

Patch(SubImageList, Defaults(SubImageList), {Title: DataCardValue51.Text, 'Image Info': JSON(UploadedImage2.Image, JSONFormat.IncludeBinaryData)})

 

The image is then displayed in an image control with this function: 

 

Substitute(LookUp(SubImageList,Title = DataCardValue51.Text, 'Image Info'),"""","")

 

Thank you again!

Categories:
  • WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    Hi @Ginko ,

    You code will produce a new record - try this

    Patch(
     SubImageList, 
     {Title: DataCardValue51.Text},
     {
     'Image Info': 
     JSON(
     UploadedImage2.Image, 
     JSONFormat.IncludeBinaryData
     )
     }
    )

     

    Please click Accept as solution 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 Thumbs Up.

    Visit my blog Practical Power Apps

  • Ginko Profile Picture
    221 on at

    Hi Warren,

     

    Thanks for the attempt, I put your code in and its creates Title-less entries in the Sharepoint list. Was this the intent? Do you know how we can adjust it to overwrite existing entries, while retaining the same Title?

     

    chrome_x9MTKNo595.png

  • Verified answer
    WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    Hi @Ginko ,

    Yes - the best way is to use the ID - you need to get it from somewhere.

     

    With(
     {
     wID:
     LookUp(
     SPList,
     Title = DataCardValue51.Text
     ).ID
     },
     Patch(
     SubImageList, 
     {ID: wID},
     {
     'Image Info': 
     JSON(
     UploadedImage2.Image, 
     JSONFormat.IncludeBinaryData
     )
     }
     )
    )

     

    If this does not work, there is something wrong with the output of your lookup.

    Please click Accept as solution 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 Thumbs Up.

    Visit my blog Practical Power Apps

  • Ginko Profile Picture
    221 on at

    This worked perfectly, thank you!! That wID is no joke, so grateful I have this example now for future uploads!

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard