Required SharePoint Document Metadata – Flow Trigger
In SharePoint back in the old days, there used to be a way to have fields/columns that were required for documents, and when a single document was uploaded, the user was prompted to fill in those required fields. As you may have noticed, in SharePoint Online, documents can be easily uploaded and bulk uploaded without anything prompting you or preventing upload/check in if the required fields aren’t filled out. The fields do show in yellow in views, but there isn’t really a way to enforce those required fields.
In this set of posts, I’ll talk about a few different options that you have in SharePoint online with Microsoft 365, and the factors involved in those various solutions, to work with the technology available, to get close to accomplishing this. Both of these methods involve using Power Automate.
Flow Trigger Inputs
In this first method, create a flow that is triggered manually, and set required inputs which include an uploaded file. This way, you’re not sending them to the library to upload files, the users are running this flow to upload a file. Kinda ugly, but this is the quickest/easiest of my methods.
1. Create a new flow, and use the trigger Manually trigger a flow.
2. Click Add an input. This is where you’ll add all of your required fields. The field types here mostly match what you’re used to seeing in SharePoint regarding column types. Email is a person field, the rest are self-explanatory.
Rename each field as you go, and there are more options when you click the ellipsis. If you need a drop-down list, those can be found when you add a text input, as seen in this screenshot. They will all be required fields by default, but you can choose to make any of them optional. No, there isn’t a way to have dynamic or lookup information in here.
3. Add an input for File. This is the file that the user will be uploading, that your flow will place in SharePoint. See here that I renamed my file “Statement of Work” and customized all of the field names and hint text.
4. Add an action to initialize a variable, and call it varFileName, and make it a string. This is where you’ll store the name of the file that gets uploaded.
For the Value, use the following expression: (I don’t recommend copying and pasting this code)
5. Add the SharePoint Create File action. Use your variable as the file name, and use the dynamic file content from the trigger for the file content. Pick the place in SharePoint where you want the file to end up.
6. Add the SharePoint Update file properties action. Fill in all of your SharePoint fields per the inputs that you created in the trigger. For the Id, select the ItemId of the file you just created in the previous action.
7. Save the flow.
8. Test the flow by running it. Fill in all the fields, upload a file, and Run flow.
9. Next you’ll need to give people “run only” access so that they can run the flow. On the flow’s main screen (seen above), in the Run only users section, click Edit. You can add people or groups. If the users *don’t* have access to the SharePoint library where the files are being created, you can set it to run as you the flow owner when it creates the file. In this example, I’m giving Billy access, but he doesn’t have access to that SharePoint site, so I can change the drop-down box to use this connection (with my name). You don’t have to change this setting. It’s only needed if the user doesn’t have access to that location in SharePoint.
10. You’ll need the hyperlink to the flow, which you can get from the email that arrives when the flow is shared with someone. This is the email that Billy receives. Click Get Button. Grab the URL of the page that it takes you to
11. This is what the page looks like. This URL can now be used from anywhere. You can create a button on your SharePoint site that takes people to this page.
Again, this is fairly ugly, but pretty simple since it’s only 4 actions in the flow. Here’s the whole thing. Oh, and be careful about that run-only user email that gets sent. It doesn’t give you the option to NOT send an email when sending to a group of people, so you may want to give them a head’s up if sending to many people as “run as” users.
Here’s the video where I go through these steps, starting at 3:15. In this video, I also show how you could do something like send the file to a different document library depending on which department was selected, from a drop-down list of departments.
Ooo…looking forward to the companion posts for this! We’re trying to solve this exact problem right now and I refuse to switch back to classic library view.
You read my mind. Thank you, as usual, for being spot-on.
At least they fixed it for pages – https://admin.microsoft.com/AdminPortal/Home?ref=MessageCenter&id=MC224173
Pingback: Required SharePoint Metadata Multiple Files | @WonderLaura
Does this method work with managed meta data fields ? I’m guessing we would have to maintain any drop down lists in power automate and SharePoint separately.
yes the drop-downs would be managed separately, so doing this with managed metadata would be a lot more work.
I get this error message with my managed meta data column when using this method. “the data returned from the tagging ui was not formatted correctly”
From what I read it looks like I need to pass a term name|term guid format. Is that the case?
Yes, that is correct.
I added ‘Run only users’ (trying both options with their permissions) but no email is being generated. What am I missing? Any help is appreciated.
“no email is being generated”. Does that mean the flow is not running? What does the flow log say is happening.
Hi Laura! Thank you for this amazing post. I have one question: how would you manage multiple documents? Do you need to initialise a variable for each one? And how do you “group” them for sending them on an email?
Thank you in advance!!
Hi Paulina, in the video I talk about how you could do it via a Microsoft Form, and that way, you could have them attach multiple documents.
Interesting way. Question:
1. If I want users to enter customer name as an input (it should be one of the options from List items in same share point). How can i achieve it. ? I would imagine a drop down inputted from list data.
2. and then based on customer input, file should go exactly in that customer folder. do you think this is doable? i would imagine, a variable initialization based on customer name input and then building a Path via another variable initiatialization for path.
Thanks in advance..
There is not a way to do a lookup in the initialization form as an input, and there is not a way to do one in a MS Form, either, sorry.
Hi Laura, this is probably the wrong place to enter this question but I was reading a blog by Jim Ongena and he mentioned your name in connection to a reusable Power Automate. We deal primarily in the Project Online space and as you are probably aware each Project can have an associated SharePoint Project site behind it in which you can have Issues and Risks list and Document libraries. In the past we were able to deploy out SPD workflows with the site templates but with the introduction of Automate we can’t associate a Power Automate since during the site create a new list and library is created with the same name but a different ID. The challenge would be to develop an Automate that could be used on each separate site. The URL would be https://testsite.sharepoint.com/sites/pwa_dev/P3%20BCH%20Test/Shared%20Documents, with P3 BCH Test being the site name. Therefore what trigger could we use to capture the site name into a variable since the rest of the URL stays the same. I’ve tried a manual but I can’t access the URL to split out the site name. The idea would be to find a solution which would allow us to share a single Automate which could be shared with all the Project Sites.
If you need more info please advise.
Thanks in advance, Brian.
Great idea, but I’m not sure how to accomplish that. You could create a solution and put environment variables in it (for the URL) and then make a copy of that solution for each project site. Just a guess.