I am trying to create a flow that will update a particular file property for items in a SharePoint list on a regular schedule.
In my SharePoint list, I have a custom "Archive" column with Yes/No choice options. I want my flow to run once a week and automatically check "No" in the Archive column if the file created date is seven days old.
What is the correct expression(s) to use for determing if the created date is 7 days old? I assumed I should use the subtractFromTime expression, but I am not having success.
I have made a test on my side and please take a try with the following workaround:
@equals(formatDateTime(addDays(items('Apply_to_each')?['Created'], 7), 'MM/dd/yyyy'), formatDateTime(utcNow(), 'MM/dd/yyyy'))
The flow works successfully as below:
Thank you for responding! This is great.
I cannot use "Get Items", because the files I want to automatically archive are not list items. The files are in a Document Library, so I should use "Get file (properties only)", correct?
I applied the recommended changes to the flow, but I have not been able to successfully run it yet. The flow says it ran successfully, but it is not updating the files.
The SharePoint document library is a list actually, on my side, I use SharePoint Document Library name as a custom value of List Name field in "Get items" action.
Note: You can upload a pbix file to Onedrive or any web storage and share the link. Do mask sensitive data before uploading.
Thank you for this additional information. I updated the flow accordingly.
I am still not getting the expected results. For example, I have a document with a created date of 10/16/2017. I am expecting the "Archive" property to be updated to "Yes" when the flow runs.
Below is a screenshot of the archive step of my flow.
Features releasing from October 2020 through March 2021
We are excited to announce the launch of Power Virtual Agents Community. Check it out now!
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!