web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Creating an automation...
Power Automate
Unanswered

Creating an automation to delete files on a SharePoint folder after 7 days, teams private group

(0) ShareShare
ReportReport
Posted on by 2

Hello, I am trying to build an automation to delete files on a SharePoint folder, after 7 days. The sharepoint site is a Teams private group but I am getting this error message. Can anyone please help?

 

ERROR.jpg

 

Categories:
I have the same question (0)
  • David_MA Profile Picture
    12,908 Super User 2025 Season 2 on at
    Re: Creating an automation to delete files on a SharePoint folder after 7 days, teams private group

    Your filter query is not properly formatted. It needs to be like this:

    David_MA_0-1680095442894.png

    The expression used is the following and needs to be within single quotes:

     

    addDays(formatDateTime(utcNow(),'yyyy-MM-dd'),-7)

     

    Since your screen shot shows ['LastModified'], I assumed you want the logic based on the Modified date. If you want to base it on the created date, replace Modified with Created in the filter query.

  • Chandni Profile Picture
    2 on at
    Re: Creating an automation to delete files on a SharePoint folder after 7 days, teams private group

    Thank you so much for responding.

    Part of the issue was a permission thing, I wasn't an owner to the Teams site so I added myself as the Owner but now I get this error message 

  • David_MA Profile Picture
    12,908 Super User 2025 Season 2 on at
    Re: Creating an automation to delete files on a SharePoint folder after 7 days, teams private group

    Based on the screen shot, the error is because you typed the expression into the filter query rather than using the expression builder to create the expression in the filter query. If you look at my screen shot I posted, the expression is in a pink box, which indicates it was created with the expression builder. When your cursor is in the filter query box, this window will open. Choose the Expression tab and enter it there and press OK.

    David_MA_1-1680178050051.png

    And I just noticed, I don't know what I was thinking when I gave you the earlier expression. This is the expression you want to use:

    addDays(utcNow(),-7,'yyyy-MM-dd')

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard