Dynamically Populate SPO List With Files From Specific Folder?

Deleted
Not applicable

Can I dynamically populate a field in a SPO list (when a new item is being added) with a list of files (user will select one file) from a specific doc library or folder?

16 Replies

Any info is appreciated

Hello cgtrman,

 

Maybe not natively in SPO, but you could possibly create a dropdown menu on your form with a list of filenames, then use Flow to attach a file based on the selection from a document library.

Thanks for your response. I am not looking to attach a file but rather offer the user a list of file names to select one from. Looking for a way to populate a SPO List "Add new item" field with a list of file names to select from.

cgtrman,

 

The only thing I can think of would be to create different content types for each file, then set the list up to manage content types. The user would then have a list of only templated entries if you will. You can do the same in a document library and it looks something like this. Unless I am misunderstanding your request, and if so I apologize.

image.png

I created a screenshot to clarify what I'm trying to accomplish.  While viewing a SPO list, a user clicks "Add new item" and sees this form. For the File field, it is not a free-form text field but rather is a drop-down menu populated with files from a doc library.  After a user selects one file from the drop-down menu, the file name would be added to the form. Is this possible in SPO?

SP list add new item select file.PNG

ctgrman,

 

I finally understand, thank you for clarifying. You could use a calculated column for this but based on the screenshot you sent me it looks like you want to populate the item Title column. This means you probably need a workflow that would populate the title field when an item is submitted. You would also need to make title not required for this to work. You could use SharePoint workflow for this but MS flow might be a better longer term solution. I hope this helps!

Thanks for the quick response. Don't worry about how the other fields are populated (e.g., Title) and I can manage creating a Flow to perform all required tasks. How would I populate the drop-down menu with the names of the files in a specific doc library? That is the question I need solved. 

Have you tried creating a Lookup column? The lookup column would be created in your list and would lookup the Title field from your Document Library. In your document library, you could setup a workflow that automatically sets the Title field value to equal the actual file name.

Thanks @Kevin McKeown - The lookup column is a great idea. 

 

I tried using an existing doc library and then tried with the default documents library and neither one offered "Name" as a column to choose from. Both document libraries have a "Name" column but it simply doesn't appear in the drop-down for a lookup column. 

BTW I first tried using the "Title" field but it did not contain any data even though there are files in that library.

SP list lookup column for files.PNG

As you are seeing, by default the Title field in a document library does not get a value applied to it (only the Name field does). This is where the workflow comes in. You can have a workflow triggered on item creation in your document library. This workflow should be configured to copy the document Name field value into the Title field for that document. This way you will see Title values in your lookup column.

Thanks @Kevin McKeown. I am working with MS Flow to populate the Title with the filename. I got pulled off to another project so it might be a bit before I can implement your solution. Thanks for the great input.

you should be able to do that with a powerapps form. the first screen lets the user select the file, then redirects to the next form with the fields filled into based on the files content.

 

have you tried that?

I have worked with PowerApps some recently and I would prefer if users submitted their requests from a PowerApps form rather than clicking "Add new item" on a SP list page. 

 

I really only need users to provide a file name in the form. However, I need to present the user with a list of available files in a doc library. Once they select a file, there no need to retrieve additional details about the file as the filename is all that I need.

 

Can you provide a link or details on how to create a drop-down list of filenames from a doc library within PowerApps?

 

Thank you for taking the time to provide a response!

I believe you could still use the method I described before and the Lookup column for File Names would then be available for you to use in your PowerApps form just like any other column in your list.

Hi,

I don't have a link. You would just create a new data source on your form pointing to the library. Then add a drop down control and set its Items property to the Items property of the data source you added.