Forum Discussion
Brandccc
Oct 04, 2022Copper Contributor
Auto-populating columns in SharePoint for existing files and folders
Does anyone know if there is a way to auto populate columns/metadata in SharePoint with default values for existing file and folders. I have tried by going into library settings and changed the defau...
SvenSieverding
Oct 04, 2022Bronze Contributor
Did you also enter the correct item ID in the ID Field of the "update file properties" action?
Brandccc
Oct 04, 2022Copper Contributor
what or where would I get the correct item ID that i need to enter?
I have enter the correct *Site Address, and *Library Name. It is just the *Id that is that I have enter, but where would I get the correct value to enter there please, current I have just entered a random number?
I have enter the correct *Site Address, and *Library Name. It is just the *Id that is that I have enter, but where would I get the correct value to enter there please, current I have just entered a random number?
- SvenSieverdingOct 04, 2022Bronze Contributor
You get that ID from the Trigger as a dynamic content
But you might get an endless loop if you update that file in a flow that is triggered if you update an item.... You should also insert a condition that makes sure that you don't needlessly update the item (i.e. check if the two columns already have the value you want to set)- BrandcccOct 04, 2022Copper ContributorI only get the options of choosing the likes of latitude, longitude, city, country/region, timestamp, user name and user email which I have tried but again I get errors.
The ID has to be a integer of certain length
"The 'inputs.parameters' of workflow operation 'Update_file_properties' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'id' is required to be of type 'Integer/int64'. Converting the integer value '51.571610920882094' to type 'Integer/int64' will result in a loss of precision. Use the 'float()' expression if this is intended."- SvenSieverdingOct 05, 2022Bronze ContributorWhat kind of trigger did you use? Latitude/Longitude/City are properties of the "Manually trigger a flow" Trigger. You will need to use a SharePoint-Trigger
In order to make your usecase work with a flow you will need to
1) Create an automated Flow (Not a instant cloud flow)
2) Use the "When an item or file is modified"-Sharepoint Trigger and set that to watch your Document Library
3) Add some conditions that get the "folder path" from the trigger, decide in which folder the file is and i.e. in two variables with the properties for that folder
4) Check if the variables and the original data have the same value (you get the current values for the original data from the trigger)
5) If they are not the same, update the File using the "Update File Properties" Action. Use the ID you get from the trigger and the variables for the two values
Flows that sync informations between two sources can be a little bit complicated and error prone.
In my opinion you should alternatively take a look at "Document Sets"
https://mikehatheway.com/2022/02/17/modern-document-sets/