SharePoint ODATA Filter

Contents

    OData query operators supported by the SharePoint REST service

    SupportedNot supported
    Numerical comparisons
    Lt Le Gt Ge Eq Ne
    Arithmetic operators (Add, Sub, Mul, Div, Mod)
    Basic mathematical functions (rounding, lower limit, upper limit)
    String comparisons
    startsWith
    substringof
    Eq
    Ne
    endsWith replace substring tolower toupper trim concat
    Date and time functions day() month() year() hour() minute() second()Operator “DateTimeRangesOverlap”
    Query whether date-time falls into a recurring date-time pattern

    The following figure shows supported OData query options.

    SharePoint ODATA Filter 4

    asc and desc can be used for sorting!

    Helpful links on this topic:

    https://sharepains.com/2018/11/12/sharepoint-get-items-odata-filter-query/

    Further examples:

    Select a range of valuesCopyfilter=Entry_No gt 610 and Entry_No lt 615Query on GLEntry service. Returns entry numbers 611 through 614...
    AndCopyfilter=Country_Region_Code eq 'ES' and Payment_Terms_Code eq '14 DAYS'Query on Customer service. Returns customers in Spain where Payment_Terms_Code=14DAYS.&
    OrCopyfilter= Country_Region_Code eq 'ES' or Country_Region_Code eq 'US'Query on Customer service. Returns customers in Spain and the United States.Hh169248.Important(en-us,NAV.90).gifImportantYou can use OR operators to apply different filters on the same field. However, you cannot use OR operators to apply filters on two different fields.|
    Less thanCopyfilter=Entry_No lt 610Query on GLEntry service. Returns entry numbers that are less than 610.<
    Greater thanCopyfilter= Entry_No gt 610Query on GLEntry service. Returns entry numbers 611 and higher.>
    Greater than or equal toCopyfilter=Entry_No ge 610Query on GLEntry service. Returns entry numbers 610 and higher.>=
    Less than or equal toCopyfilter=Entry_No le 610Query on GLEntry service. Returns entry numbers up to and including 610.<=
    Different from (not equal)Copyfilter=VAT_Bus_Posting_Group ne 'EXPORT'Query on Customer service. Returns all customers with VAT_Bus_Posting_Group not equal to EXPORT.<>
    endswithCopyfilter=endswith(VAT_Bus_Posting_Group,'RT')Query on Customer service. Returns all customers with VAT_Bus_Posting_Group values that end in RT.*
    startswithCopyfilter=startswith(Name, 'S')Query on Customer service. Returns all customers names beginning with “S”.
    substringofCopyfilter=substringof(Name, ‘urn’)Query on Customer service. Returns customer records for customers with names containing the string “urn”.
    lengthCopyfilter=length(Name) gt 20Query on Customer service. Returns customer records for customers with names longer than 20 characters.
    indexofCopyfilter=indexof(Location_Code, ‘BLUE’) eq 0Query on Customer service. Returns customer records for customers having a location code beginning with the string BLUE.
    replaceCopyfilter=replace(City, 'Miami', 'Tampa') eq 'CODERED'
    substringCopyfilter=substring(Location_Code, 5) eq 'RED'Query on Customer service. Returns true for customers with the string RED in their location code starting as position 5.
    tolowerCopyfilter=tolower(Location_Code) eq 'code red'
    toupperCopyfilter=toupper(FText) eq '2ND ROW'
    trimCopyfilter=trim(FCode) eq 'CODE RED'
    concatCopyfilter=concat(concat(FText, ', '), FCode) eq '2nd row, CODE RED'
    dayCopyfilter=day(FDateTime) eq 12
    monthCopyfilter=month(FDateTime) eq 12
    yearCopyfilter=year(FDateTime) eq 2010
    hourCopyfilter=hour(FDateTime) eq 1
    minuteCopyfilter=minute(FDateTime) eq 32
    secondCopyfilter=second(FDateTime) eq 0
    roundCopyfilter=round(FDecimal) eq 1
    floorCopyfilter=floor(FDecimal) eq 0
    ceilingCopyfilter=ceiling(FDecimal) eq 1

    Dieser Beitrag ist auch verfügbar auf: Deutsch (German)

    Updated on 2. April 2024
    Was this article helpful?

    Leave a Reply

    Your email address will not be published. Required fields are marked *