cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Julien2
Level: Powered On

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
Community Support Team
Community Support Team

Re: On save check for existing name in SharePoint document library

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
Community Support Team
Community Support Team

Re: On save check for existing name in SharePoint document library

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

Julien2
Level: Powered On

Re: On save check for existing name in SharePoint document library

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!

Julien2
Level: Powered On

Re: On save check for existing name in SharePoint document library

Hi @v-monli-msft ,

 

Any suggestion please to fix this ?

 

Thanks

cds
Level 8

Re: On save check for existing name in SharePoint document library

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



Julien2
Level: Powered On

Re: On save check for existing name in SharePoint document library

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
Level 8

Re: On save check for existing name in SharePoint document library

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

Julien2
Level: Powered On

Re: On save check for existing name in SharePoint document library

 

@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
Level 8

Re: On save check for existing name in SharePoint document library

delete that ) before the ,

Julien2
Level: Powered On

Re: On save check for existing name in SharePoint document library

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
thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (4,845)