cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

On save check for existing name in SharePoint document library

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

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

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

11 REPLIES 11
Highlighted
Community Support
Community Support

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

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted

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!

Highlighted

Hi @v-monli-msft ,

 

Any suggestion please to fix this ?

 

Thanks

Highlighted
Impactful Individual
Impactful Individual

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")



Highlighted

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

Highlighted
Impactful Individual
Impactful Individual

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

Highlighted

 

@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) 

Highlighted
Impactful Individual
Impactful Individual

delete that ) before the ,

Highlighted

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!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (16,089)