cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Filter OData in SharePoint Get Files action by date

hi guys,

 

so I have a document library that is chokka blok full of documents(132k). I'm trying to get a way to move small ish blocks of documents into specific files. Im currently using the method below. My problem is that I know can only run a maximum of 5000 iterations of Apply to each, so to reduce the number of iterations I want to filter get files with an odata filter to pull out chunks of documents by the modified by or modified column. i just dont know how.

 

can anyone help - i've tried the documentation , by im obviously not tech enough to understand it

 

Currently the flow below works but never completes , it just runs and runs and runs

 

Recurrance

 

get files(Properties Only)

 

Apply to each

 

condition ( is eq to " text" )

 

get content

 

move file

4 REPLIES 4
v-yamao-msft
Community Support
Community Support

Hi @Anonymous,


Do you want to use filter query to return files based on the Modified date?
Let’s say you want files that modified date greater or equals 7 days ago from Today.
Then you could try the following code:

Modified ge 'formatDateTime(addDays(utcNow(),-7),'yyyy-MM-ddThh:mm:ssZ')'

Note: Please make sure the formatDateTime is surrounded by a single quote.

1.PNG
More details about Odata filter query, please check the following doc for more details:
https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90)
If you need more help, please feel free post back.

 

Best regards,
Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jake_harvey
Frequent Visitor

Just a quick followup to this old post in case someone stumbles onto it and gets thrown off like I did. If you're trying to compare a date and need more granularity than days (in my case it's supposed to run every few hours) you'll need `HH` in the format. I was confused for a bit why the timestamps were so far off, and it's because lowercase `hh` is 12-hour. Uppercase `HH` is 24 hour. So my comparison thought things like 10 pm was 10 am.

Something like...

 

Modified ge 'formatDateTime(addHours(utcNow(),-3),'yyyy-MM-ddTHH:mm:ssZ')'

 

 

using the same expression getting an error.

 

The expression "2021-07-14T01:43:07Z" is not valid. Creating query failed.
clientRequestId: db6942e6-50b2-494f-bf31-ae01bf502057
serviceRequestId: db6942e6-50b2-494f-bf31-ae01bf502057

GuillaumeP
Frequent Visitor

@Abby2992  hi, Same problem for me : try this, it worked for me. 

 

variable = formatDateTime(addDays(utcNow(),-30),'yyyy-MM-dd')

 

2021-07-23 17_15_01-Modifier votre flux _ Power Automate et 11 pages de plus - Travail – Microsoft​ .png

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (1,332)