cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lockjack
Helper I
Helper I

Upload file to SharePoint document folder via form

Hi All

I'm (Very) new to Power Automate and whilst I can use a form to attach a file to a SharePoint List and complete all the relevant column fields, I cannot find a way to do this for a SharePoint folder (Documents not list).  Can someone point me in the right direction please?

2 ACCEPTED SOLUTIONS

Accepted Solutions
S-Venkadesh
Super User
Super User

S-Venkadesh
Super User
Super User

Hi @Lockjack ,

Instead of using "Get File Content", "Get File Metadata using path" has been utilized.
Please review the previous screenshots and make the necessary corrections as indicated in the following snapshot.


SVenkadesh_0-1688665239302.png

I hope this information is helpful. If it is, please consider giving a thumbs up.

 

Best regards,

Venkadesh Sundaramurthy

View solution in original post

20 REPLIES 20
Lockjack
Helper I
Helper I

I'm guessing by the lack of responses that this is not possible?

As a workaround, I'm able to copy the file to a Document folder, but I still cannot find a method to copy the column information (Meta-data), is this possible?

S-Venkadesh
Super User
Super User

Hi @Lockjack,

It is possible to upload a file using MS Form and then add it as an attachment to a SharePoint List or upload it to a SharePoint Library.

Follow the steps below to add file as attachment:

SVenkadesh_0-1688381230969.png

 

SVenkadesh_1-1688381298408.png

Please consider giving it a thumbs up!

Click "Accept as Solution", if your problem has been resolved.

 

Regards,

Venkadesh

Lockjack
Helper I
Helper I

thank you for your response. I can upload the file from the form, it is updating the columns which I cannot update.  maybe I'm missing something but I cannot see from your images where the column data would be transferred over to the documents folder e.g. The documents folder has multiple columns all requiring data from the form.  I can do this if I upload to a SharePoint list from the form, but don't seem to be able to do this for a SharePoint Document folder?  hope that made sense thx.

S-Venkadesh
Super User
Super User

Hi @Lockjack,

In the sample flow that I explained earlier, the purpose was to add an attachment to an SPList.

Action: "Get Response Details" is used to fetch the inputs from MSForm.

Action: "Create Item" is used to create an List Item with required columns

To provide further assistance, could you please clarify if you want to:

Add an attachment with metadata to a SharePoint List?
or

Upload a file with metadata to a SharePoint Document Library?
Please let me know so that I can guide you accordingly.

Regards,

Venkadesh

Thanks again for your response. Apologies if I haven't made myself clear.  As mentioned I have succesfully managed to get responses from a form to populate all the columns in a Showpad List, and attach the file.  However, for the purpose i need this to work on SharePoint Document folder.  I have all the same column headings as my per my Sharepoint list (and form).  I can attach the file, but can not find no way of populating all the columns.

S-Venkadesh
Super User
Super User

Hi @Lockjack ,

you can follow the steps below, If you want to update the metadata of a SharePoint folder, 

  1. Retrieve the unique identifier (ID) of the folder you want to update.

  2. Use the "Update file properties" action. (It works for folder as well)

 

Regards,

Venkadesh

 

@S-Venkadesh Thank you so much for your assistance.  I could not work out how to do this via Forms. so decided to try a different approach. in that, I uploaded the attachment to SharePoint list then I created a flow that would be applied when a condition is met. I can copy the file over to the Documents folder with no problem.  But when I add the "update file properties" to flow, I get an error "bad request" - "An action failed. No dependent actions succeeded." and the error occurs in create file section.  Despite this, the file is copied over.  but because of the error, it does not proceed to the update files properties and therefore the columns are not completed.  Attached is my flow. hope you are able to assist me and thanks again for all your assistance.

S-Venkadesh
Super User
Super User

Hi @Lockjack,

Based on the screenshot provided, it appears that the flow encountered an error during file creation but you've mentioned like error occurred on "update file properties".

To assist you further, please provide more details or an additional screenshot related to the specific error encountered. This will help in identifying the issue and providing a more accurate solution or guidance.

Regards,

S-Venkadesh

Hi, the error occurred at "Create files" although this works if i don't add the update file properties. not sure what else I can share as the error message is shown on the first slide.

 

here is the download code if that helps.

{"statusCode":400,"headers":{"Vary":"Origin","X-NetworkStatistics":"0,525568,0,0,1592,0,48499","X-SharePointHealthScore":"0","X-MS-SPConnector":"1","X-SP-SERVERSTATE":"ReadOnly=0","DATASERVICEVERSION":"3.0","SPClientServiceRequestDuration":"59","SPRequestDuration":"59","X-DataBoundary":"NONE","X-1DSCollectorUrl":"https://mobile.events.data.microsoft.com/OneCollector/1.0/","X-AriaCollectorURL":"https://browser.pipe.aria.microsoft.com/Collector/3.0/","SPRequestGuid":"026e1125-17b7-470f-966f-4a5786b2a72c","request-id":"026e1125-17b7-470f-966f-4a5786b2a72c","MS-CV":"JRFuArcXD0eWb0pXhrKnLA.0","Strict-Transport-Security":"max-age=31536000","X-FRAME-OPTIONS":"SAMEORIGIN","Content-Security-Policy":"frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com teams.microsoftonline.cn *.powerapps.com *.yammer.com *.officeapps.live.com *.office.com *.stream.azure-test.net *.microsoftstream.com *.dynamics.com *.microsoft.com onedrive.live.com *.onedrive.live.com securebroker.sharepointonline.com;","MicrosoftSharePointTeamServices":"16.0.0.23821","X-Content-Type-Options":"nosniff","X-MS-InvokeApp":"1; RequireReadOnly","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","x-ms-apihub-obo":"false","Cache-Control":"max-age=0, private","Date":"Tue, 04 Jul 2023 13:40:34 GMT","P3P":"CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"","X-AspNet-Version":"4.0.30319","X-Powered-By":"ASP.NET","Content-Length":"352","Content-Type":"application/json","Expires":"Mon, 19 Jun 2023 13:40:35 GMT","Last-Modified":"Tue, 04 Jul 2023 13:40:35 GMT"},"body":{"status":400,"message":"A file with the name Shared Documents/General/Showpad Asset Folder/boot rack image.jpg already exists. It was last modified by i:0#.f|membership|gordon_jackson@goodyea on 04 Jul 2023 06:37:11 -0700.\r\nclientRequestId: 026e1125-17b7-470f-966f-4a5786b2a72c\r\nserviceRequestId: 026e1125-17b7-470f-966f-4a5786b2a72c"}}

S-Venkadesh
Super User
Super User

Hi @Lockjack

Try the solution as described in the article -https://sharepointstuff.com/2022/04/20/overwrite-files-using-create-file-action

Regards,

S-Venkadesh

sandeepstw
Super User
Super User

Hi, 

 

User this - 

1. Create a new Flow. Select 'When a new response is submitted' from Forms as the trigger. Choose the correct Form Id.

2. Add the 'Get response details' action from Forms. Choose the correct Form Id and the Response Id from the Dynamic content.

3. Now, add 'Create file' action from SharePoint. Provide the Site Address and Folder Path where you want to store the file. For the File Name, select the file name from the Dynamic content of the 'Get response details' action. In the File Content, choose the file content from the same.

4. Now, if you want to update additional properties for the file, add an 'Update file properties' action from SharePoint.

5. Provide the Site Address, Library Name and Id from the Dynamic content. Add additional properties as needed. Fill out the properties using data from the 'Get response details' action.

6. Save your Flow.

You can now submit a new response on your form with a file, and the file will be saved to the specified SharePoint document folder with all the relevant properties. Please replace placeholders like Site Address, Library Name etc. with actual values as per your setup.

 

Please give kudos and mark as solution if this helps. 

 

Thanks, 

Sandeep 

 

Lockjack
Helper I
Helper I

you are an absolute star thank you. All works and very happy with your correspondence. thanks for your help

sandeepstw
Super User
Super User

Please give kudos as well 🙂

 

@S-Venkadesh  Not sure why but my original flow is working perfectly, apart from I get an error when trying to open the attachments, basically they appear to be corrupted in some way.  They upload fine but no matter what file type I use they will not open (pdf says "Failed to upload PDF", PPPT tries to open in Desktop App but fails saying need to be repaired, but that doesn't work either.  Attached is my flow, so hopefully you can see why this is happening. Thanks. 

Hi @Lockjack , As issue is related to attachment, it would be helpful if you could provide some details along with screenshots on how you are obtaining the file content from the form and adding an item with the attachment. This will enable us to better understand and pinpoint the cause of the issue.

 

Regards,

Venkadesh

Lockjack
Helper I
Helper I

Thanks for getting back so quickly. This is just the normal upload file which comes as a function within Forms (see image).  FYI: I can open the attachments from the OneDrive where these are stored as part of the Forms (App/Microsoft/blah/blah) but they will not open when these are sent/attached to the SharePoint List.  

S-Venkadesh
Super User
Super User

Hi @Lockjack , could you please attach a screenshot of the Flow logic where you attach the document content to the SharePoint List item?

 

Regards,

Venkadesh

Lockjack
Helper I
Helper I

This is all sown in the attachment. hope you can help

S-Venkadesh
Super User
Super User

Hi @Lockjack ,

Instead of using "Get File Content", "Get File Metadata using path" has been utilized.
Please review the previous screenshots and make the necessary corrections as indicated in the following snapshot.


SVenkadesh_0-1688665239302.png

I hope this information is helpful. If it is, please consider giving a thumbs up.

 

Best regards,

Venkadesh Sundaramurthy

Helpful resources

Announcements

Celebrating the May Super User of the Month: Laurens Martens

  @LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!        

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!    

Welcome to the Power Automate Community

You are now a part of a fast-growing vibrant group of peers and industry experts who are here to network, share knowledge, and even have a little fun.   Now that you are a member, you can enjoy the following resources:   Welcome to the Community   News & Announcements: The is your place to get all the latest news around community events and announcements. This is where we share with the community what is going on and how to participate.  Be sure to subscribe to this board and not miss an announcement.   Get Help with Power Automate Forums: If you're looking for support with any part of Power Automate, our forums are the place to go. From General Power Automate forums to Using Connectors, Building Flows and Using Flows.  You will find thousands of technical professionals, and Super Users with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Power Automate community forums. Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered. Galleries: The galleries are full of content and can assist you with information on creating a flow in our Webinars and Video Gallery, and the ability to share the flows you have created in the Power Automate Cookbook.  Stay connected with the Community Connections & How-To Videos from the Microsoft Community Team. Check out the awesome content being shared there today.   Power Automate Community Blog: Over the years, more than 700 Power Automate Community Blog articles have been written and published by our thriving community. Our community members have learned some excellent tips and have keen insights on the future of process automation. In the Power Automate Community Blog, you can read the latest Power Automate-related posts from our community blog authors around the world. Let us know if you'd like to become an author and contribute your own writing — everything Power Automate-related is welcome.   Community Support: Check out and learn more about Using the Community for tips & tricks. Let us know in the Community Feedback  board if you have any questions or comments about your community experience. Again, we are so excited to welcome you to the Microsoft Power Automate community family. Whether you are brand new to the world of process automation or you are a seasoned Power Automate veteran - our goal is to shape the community to be your 'go to' for support, networking, education, inspiration and encouragement as we enjoy this adventure together.     Power Automate Community Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Users online (3,305)