Hi @ITDave,
Would you please rearrange your needs here and post it out?
Maybe we could also provide the right workaround for you.
Please provide more details about your needs, it is best to attach a screenshot of the Flow configuration.
Best Regards,
So I am trying to create a flow to remove old files from a sharepoint folder. The folder in question is a sub folder in the files area of a team. I have created a Recurrence that checks every hour. Get Files (properties only) on the Team area and the Library name is the folder that I want to remove files from. Then I want to delete the files that are older than the condition set. When I test the flow I get an error 404 list/item not found....
Help please 🙂
ITDave
What I can see from my own experience is that your sub folder is too deep for the flow to run. It only allows 1 level sub folder from the "Documents" folder to work. Do a Test with your Flow where your sub folder is directly under the "Documents" folder with a few files.
Hi @ITDave ,
The reason that seems to cause the error is that the configuration of Library Name and List Name does not meet the requirements.
The Get files action can only select the root directory of the Library. This action can only get all the files in the current Library. There is no way to select the specified folder.
You need to use Condition to filter the files in the specified folder.
Please refer to the following method to configure your Flow:
Expression reference:
utcNow('yyyy-MM-dd') is greater than formatDateTime(addMinutes(items('Apply_to_each'),60),'yyyy-MM-dd')
Please take a try. Sorry for late reply.
Best Regards,
I am still having problems. I usered the following condition - As yours:
I get the following error:
Any idea what is going wrong now?
Best regards
ITDave
Hi @ITDave ,
My mistake, the expression seems to be missing a part.
Try using the following expression:
formatDateTime(addMinutes(items('Apply_to_each')['Created'],60),'yyyy-MM-dd')
Note: each is lowercase
Please take a try again and let me know if issue still exist.
Best Regards,
Hi @ITDave ,
Do you need any other assistance?
Regards,
Hi @ITDave ,
Any issue?
Please provide more details.
Best Regards,
Please try this expression:
formatDateTime(addMinutes(items('Apply_to_each')['Created'],60),'yyyy-MM-dd')
Regards,
Hi @v-bacao-msft,
I think we are getting a little closer! 🙂
This time the flow ran succesfully but no files were deleted. Again the error is below....
Best regards
ITDave
Hi @ITDave ,
The reason for false is that one of the conditions set in Condition is not met.
First make sure that the configured Folder path is the same as the Folder path you are currently testing.
In addition, the date not match may be the main reason, you could try to use Compose to output utcNow('yyyy-MM-dd') and formatDateTime(addMinutes(items('Apply_to_each')['Created'],60),'yyyy-MM -dd') values to see if they are equal.
It is recommended to create a new Library or a new folder to test to prevent accidental deletion of files.
Take a try again.
Regards,
So I have gone back to basics:
With the above I can delete ALL files in ALL folders leaving the folder structure intact. I cannot get the FOLDER PATH to read my folder structure. Can we make this work first? The files I want to delete are in the highlighted folder:
What should I type in this box?
I have tried:
\Documents\General\Email Messages\
Documents\General\Email Messages\
\General\Email Messages\
General\Email Messages\
None of the above seem to work... Nothing gets deleted.
If we can sort this part then we can look at checking the files properties for the date?
Best regards
ITDave
Hi @ITDave ,
It seems that the Folder path should be Documents/General/Email Messages/.
You can get the Folder path in this way.
Put a file in the specified folder and use Get file properties action to get the Folder path, which is the one you want to configure in your Flow.
Please take a try.
Best Regards,
Good morning Barry @v-bacao-msft
We are definately getting somewhere now! I can delete files from the correct folder.
So I tried re-applying the utcNow and the formatDateTime but nothing is getting deleted. I ran compose to get results.
If I change '60' to any other number in the formatDateTime I get the same results:
formatDateTime(addMinutes(items('Apply_to_each')['Created'],1),'yyyy-MM-dd')
Is there a different way of checking when the file was created?
Best regards
ITDave
Hi @ITDave ,
Use such an Expression to get Created Date:
items('Apply_to_each')['Created']
formatDateTime(items('Apply_to_each')['Created'],'yyyy-MM-dd')
I think your needs have been basically solved, you can consider creating new files to do some testing.
Regards,
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
User | Count |
---|---|
41 | |
40 | |
37 | |
34 | |
30 |
User | Count |
---|---|
48 | |
37 | |
35 | |
26 | |
24 |