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 / On save check for exis...
Power Apps
Answered

On save check for existing name in SharePoint document library

(0) ShareShare
ReportReport
Posted on by 1,712

Hello everyone!

I have created a page that will be used to take pictures, to write the filename of the picture,and to choose the category of the picture and save the data to SharePoint library using flow.
I have a problem which consists of for example while user 1 saves an image under the name ”TESt” if someone else saves a different image under the same name the first image is replaced by the second person’s image.

I want to check for existing column Name in my document library before allowing the user to save the image, which consists of a notification that brings notice that an other file is named the same name already.

Capture.PNGCapture1.PNG

So what will be the function to check for the name column in SharePoint’s document library and send notification to the user ? any help would be appreciated.

I am using the following function OnSelect to start the flow on save.

Set(FileLinkFromFlow, Powerapps.Run(TextInput2.Text & ".jpg", Dropdown1.Selected.Value, TakenPic).filelink);Reset(TextInput2);Navigate(ViewReport,None)

Thank you!

Categories:
  • Verified answer
    v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi @Julien2 ,

     

    You could use below formula to achieve this:

    If(IsBlank(Lookup(LibraryName,'File name with extension'=TextInput1.Text)),Set(FileLinkFromFlow, Powerapps.Run(TextInput2.Text & ".jpg", Dropdown1.Selected.Value, TakenPic).filelink)&&Reset(TextInput2)&&Navigate(ViewReport,None),Notify( "Duplicated file name", NotificationType.Error ))

     Regards,

    Mona

  • EBMRay Profile Picture
    1,712 on at

    Hi @v-monli-msft ,

    Thanks for replying. But i am stuck in the function with what i should replace instead of 'File name with extension',while it should be the text value of the user that he choose to name the file.

    So it's not a specific name that i want to check for it. I want to check if the text value does not exist in the list it will save the image else it should notify the user to use another name.

     

    I've also tried to check for a specific file i got error in the function:

    IsBlankFunc.PNG

    The document library name is named: Expenses Bills Images

    But i think that it's also not taking the name in the function.

     

    So what i should use in the function instead of 'File name with extension' to get text value of the user that he used to name the file ?

     

    Thank you!

  • EBMRay Profile Picture
    1,712 on at

    Hi @v-monli-msft ,

     

    Any suggestion please to fix this ?

     

    Thanks

  • cds Profile Picture
    1,001 on at

    Here's what I would do.

    On savebutton.text:

    If(TextInput2.Text &".jpg" exactin DataSource.ColumnName, "This filename is already in use", "Save File")

    Then savebutton.OnSelect:
    If(TextInput2.Text &".jpg" exactin DataSource.ColumnName, Notify("Cannot use duplicate filename", NotificationtypeError, Run save commands)

    if the & "jpg" doesn't work, you may have to Concat(Textinput2.text, ".jpg")



  • EBMRay Profile Picture
    1,712 on at

    Hi @cds ,

    Thank you for replying!

     

    So i have set Text function to the save button to the following function which works.

     

    If(TextInput2.Text &".jpg" exactin 'Expenses Bills Images'.'{Name}' , "This filename is already in use", "Save to SharePoint")

     

    But OnSelect i got some errors in the function because i got other conditions used,if you can guide me to complete this function which is the following:

     

    If(TextInput2.Text &".jpg" exactin 'Expenses Bills Images'.'{Name}'),Set(FileLinkFromFlow, Powerapps.Run(TextInput2.Text & ".jpg", Dropdown1.Selected.Value, TakenPic).filelink)&&Reset(TextInput2)&&Navigate(ViewReport,None),Notify( "Duplicated file name", NotificationType.Error ))

     

     I tried also If(Concat(Textinput2.text, ".jpg").. but didn't works.

     

    Capture.PNG

  • cds Profile Picture
    1,001 on at

    you are saying if exactin, create anyway. put your command in the false position of the IF and notify in the true spot

  • EBMRay Profile Picture
    1,712 on at

     

    @cds 

    I tried this one but i get error where i have marked the comma in RED any idea why?

    If(TextInput2.Text & ".jpg" exactin 'Expenses Bills Images'.'{Name}',Notify( "Duplicated file name", NotificationType.Error )),Set(FileLinkFromFlow, Powerapps.Run(TextInput2.Text & ".jpg", Dropdown1.Selected.Value, TakenPic).filelink)&&Reset(TextInput2)&&Navigate(ViewReport,None) 

  • cds Profile Picture
    1,001 on at

    delete that ) before the ,

  • EBMRay Profile Picture
    1,712 on at

    Hi @cds ,

    Sorry for late reply.

    I removed the ) before , it's showing red at the end of the function and the error is the following:

    Capture.PNG

    Any idea?

    Thank you!

  • cds Profile Picture
    1,001 on at

    Highlight the error. Post that.

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 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard