Hi,
I'm trying to schedule a flow to run once a month to delete all entries from an Events calendar, in SharePoint, going back 180 days for the first run then change that to 90 days.
I'm getting an error but not sure why??
I've used Get le 'Expression' but that seems to delete all events after the Now() date??
My current Flow is
The error i get is
Solved! Go to Solution.
Yes use EventDate only. Created date will be today only as you made them today.
So, maybe just delete if event date has already passed more than 6 months.
Hey @ClarkyPA365
Sorry was not able to help you on Monday. In the above, the only problem I see is you have used it rather than lt.
Its a lower l and lower t. And you have use lower i and lower t.
Try this. Lets see the result and go further.
Hi,
No worries I know we have day jobs to do 😊
Replaced i (lower case) with I (upper case) and still the same error??
You are using Capital I.
You have to use small L=l
Just copy this actually and paste it in filter query:
Created lt @{addDays(utcNow(),-180,'MM/dd/yyyy')}
Hi @Sundeep_Malik
I really don't know what is going on??
Copied your expression
The Flow fails with this
I am also not sure whats wrong. 😶
Need help here please.
Also attach single quotes around the expression
Created lt '@{addDays(utcNow(),-180,'MM/dd/yyyy')}'
My Bad, I missed the single quotes.
Hi @Sundeep_Malik ,
addDays(utcNow(),-180,'MM/dd/yyyy') this part needs to be written in expression.
Created lt 'addDays(utcNow(),-180,'MM/dd/yyyy')'
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Hi,
I've tried it with the single quotes...
When I copy and paste the expression in it seems to remove the '@' sign and swiggle brackets
Then when I add the expression in manually I get this
So
@{}
is just the symbol of expression.
So lets say, for array []
square brackets is the symbol, for a expression in power automate @{} is the symbol.
So, if you directly write it in the expression, then there is no need to write @ {}
but if you are just typing it then if you write @ {}
Power Automate will automatically understand you are typing an expression.
I hope I was able to explain it properly??
Hi, @Sundeep_Malik
Thank you I do understand 🙂
I've tried using Event ge instead of Created lt and this works in away.
It deletes all entries back to May this year which is 6mths but also deletes all future events?? So entries for Jan to May 2022 are still visible but after May 2022 no entries show
I tested by adding events in for the last few days of November, some in December, January 2023 and these were all deleted??
Instead of ge, write lt or le in that.
Event ge expression
means it will delete all the events from 6 months before to future
Write
Event lt expression
Event le expression
So, now write this:
Event lt 'addDays(utcNow(),-180,'MM/dd/yyyy')'
Or
Event lt '@{addDays(utcNow(),-180,'MM/dd/yyyy')}'
This will only delete older than 6 months.
Hi,
Just wondering if this expression Created for this test purpose may be wrong.
As when the previous flows have deleted all the entries, I Create new ones, for testing, so the creation date for all of them will be the same day and not 180 days ago??
So, would EventDate be better used??
When I tested the above no entries were deleted
you can try
Yes use EventDate only. Created date will be today only as you made them today.
So, maybe just delete if event date has already passed more than 6 months.
Hi,
Tried EventDate only
and still get error advising this
Hi @Sundeep_Malik
Sorry been a long day 😆
It worked 😁
Entries in May and months before are deleted and entries from May 19/11 onwards are still visible.
Thank you all for your assistance 👍
The problem with the query you provided is that its missing the single quotes around the date value. When you add them it will work.
Created lt '@{addDays(utcNow(),-180,'MM/dd/yyyy')}'
User | Count |
---|---|
27 | |
14 | |
12 | |
9 | |
9 |
User | Count |
---|---|
50 | |
30 | |
27 | |
24 | |
20 |