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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get Items from a Share...
Power Automate
Answered

Get Items from a SharePoint List

(0) ShareShare
ReportReport
Posted on by

I have a Custom SharePoint list called 'Event Form' with mulitple fields.

 

I would like to create an automatic Flow that emails a set of records and some of their fields.

 

I am okay with the reccurance and the Email aspect, but I seem to be tripping up on the Get Items tab:

Capture.PNG

 

 

 

 

 

 

 

I don't want to retrieve all entries, just those that have been created within the last 7 days.

I would also like to order them by date on that particular record.

 

Any help would be greatly appreciated and I can provide further info if needed.

Categories:
I have the same question (0)
  • jhall Profile Picture
    636 on at

    This post is a decent starting reference for filtering by date:

     

    https://powerusers.microsoft.com/t5/Building-Flows/FLOW-Get-Items-Filter-SharePoint-list-on-Date/td-p/85238

     

    This one also addresses subtracting days:

     

    https://powerusers.microsoft.com/t5/Building-Flows/expiry-date-should-equal-minus-30-days-formula-todaysdate-30/td-p/60296

     

    Is that what is tripping you up?

     

    To ensure you're getting what you want you can do a variable step and create a String variable and assign it the value of the date you're looking for similar to:  @{formatDateTime(addDays(utcNow(),-7),'yyyy-MM-dd')}

    chrome_2019-01-25_16-31-32.png

     

    Then when you do the GetItems make it similar to:  TestDate gt  '@{variables('SevenDaysAgo')}'chrome_2019-01-25_16-32-42.png

    This will test if the value in the column TestDate is > than 7 days ago.

     

    One thing you might miss is the single quotes around the date value.

     

     

  • Community Power Platform Member Profile Picture
    on at

    Thank you @jhall

     

    I have followed your methods, but I appear to be getting the following message. Any idea why this may be?Capture.PNG

     

    The expression "21-01-2019" is not valid.
    clientRequestId: 3567a8f0-28e1-4cdb-9cd7-1955b96a5a65
    serviceRequestId: ab6cba9e-f07a-8000-a4e8-aa38908b7ec4

  • jhall Profile Picture
    636 on at

    Two likely issues.

     

    1. I'm guessing that you did not include the SharePoint column that you are querying against.  In my example I was using a column I created in my SharePoint list called TestDate.
    2. Remember the quotes around the date value.  Even if you have this in a variable, it has to be included inside quotes for Flow to recognize it as a Date.

     

    Again, see my example I did:

    chrome_2019-01-28_08-50-05.png

    You need to include in your own Filter Query:

    1. The name of the SharePoint column you are querying against (TestDate in my example)
    2. The operation you are using to compare the two values (e.g. gt, eq, lt, etc.)
    3. The string variable (SevenDaysAgo in my example), inline calculated value, or raw string (e.g. '21-01-2019') of the date inside single quotes (I'm not 100% certain if double quotes will work - just haven't tested).

    I also realize that you're potentially dealing w/ a date value that is localized for your region.  You have yours configured as dd-MM-yyyy (i.e. day-month-year).  From a style and universality perspective, I generally try to do things as yyyy-MM-dd as this helps w/ an array of things per good habits across platforms.  

     

    But now I'm just getting picky.  😉

  • Community Power Platform Member Profile Picture
    on at

    @jhallOkay, I realise I may be a little out of my depth but im persevering.

    Capture.PNG

     

     

     

     

     

     

     

     

    The name of the column in my SP list is General On-Sale

     

    I'm also confused about your point 2. The operation you are using to compare the two values (e.g. gt, eq, lt, etc.)

    What do those abbreviations mean?

     

    And yes im from the UK so using localised formatting.

     

    Many Thanks for your help.

  • Verified answer
    jhall Profile Picture
    636 on at

    No worries.  This gets complex and the UI within Flow makes it seem easy, but then blows up at the weirdest times.  I've got a number of rants and workarounds for PowerApps/Flow that I try to write up solutions on one of my blogs so I won't forget the weird thing I ran into that one time.  It just takes time to adapt to some of the quirks of this platform.  Particularly when it seems to work so poorly w/ SharePoint at times.

     

    You're running into ANOTHER problem SharePoint issue, which is spaces in your column name.  Fix this by replacing any spaces in the column name with _x0020_.  So in your Filter Query field change General On-Sale to General_x0020_On-Sale.

     

    See a further discussion here: https://powerusers.microsoft.com/t5/Building-Flows/OData-syntax-for-sharepoint-column-with-a-space-Get-Items-action/td-p/147705

     

    The abbreviations are what Flow uses for comparisons:

    • gt = >
    • lt = <
    • eq = =   (I find this line particularly funny - something might be wrong with me)

    The syntax here is highly annoying for what is supposed to be a 4GL automation environment.  For the life of me, I don't understand how they truly believe a Business Analyst w/ limited to no real-world programming experience would be capable of working within Flow for anything beyond the basics.

     

  • Community Power Platform Member Profile Picture
    on at

    @jhall haha yes i know the feeling!

     

    Unfortunately, still didnt work.

    Capture.PNG

     

    Value: 

    formatDateTime(addDays(utcNow(),-7),'dd-MM-yyyy')
     
     
     
     
     
     
     
     
     
     
     
    The date in my "General Onsale" column in my list is todays date.
     
    Error received = The expression "General_x0020_On_x002d_Sale gt 22-01-2019" is not valid.
    clientRequestId: 87a9ce8e-71aa-45f0-846a-ad490bcd1875
    serviceRequestId: a0b5ba9e-0042-8000-a4e8-acedddfd585f
     
    I will keep persevering, thanks again for your help,
     
    Yours : frustrated budding Programmer 🙂
  • Community Power Platform Member Profile Picture
    on at

    @jhall It was those godamn quotes! They must have jumped out when I edited it previously.

     

    Although now it is timing out:

     

    "message": "String was not recognized as a valid DateTime.\r\nclientRequestId: 3d1d1e52-97c0-40fa-806c-b37fed97421d\r\nserviceRequestId: 86b8ba9e-f063-8000-ac3a-0196ccfdb0f6"
     
    Capture.PNG
     
    *puts head on table*
  • Community Power Platform Member Profile Picture
    on at

    And this was due to my localised date formatting!

     

  • jhall Profile Picture
    636 on at

    Make sure you put that date in quotes!  😄

     

    In your post you have:

    chrome_2019-01-29_09-51-05.png

    Once you put some quotes around the date you've included it will work.  Look closely at mine as I have a single quote before and after my SevenDaysAgo variable:

    chrome_2019-01-28_08-50-05.png

     

    Fix that and you're golden.

     

    ##EDIT: And of course now I see you caught that.  You're now officially a programmer.  😄

  • Community Power Platform Member Profile Picture
    on at

    @jhall Haha almost! Now I have the task of making the output look user friendly but I have all the information I need so I'm happy with that. Thanks again for all your help today! 🙂

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard