Zum Inhalt springen
/ Home / Knowledge / SharePoint ODATA Filter

SharePoint ODATA Filter

Inhalt

Andreas Olbricht
Cloud und Microsoft 365-Experte
OIT GmbH
Profil ansehen

OData-Filterabfragen im SharePoint REST-Dienst ermöglichen es, Listeneinträge gezielt zu filtern, zu sortieren und einzugrenzen. Die folgende Übersicht zeigt, welche Operatoren unterstützt werden – inklusive praktischer Beispiele für den direkten Einsatz in Power Automate, SPFx oder anderen REST-Clients.

Vom SharePoint REST-Dienst unterstützte OData-Abfrageoperatoren

Unterstützt Nicht unterstützt
Numerische Vergleiche
Lt Le Gt Ge Eq Ne
Arithmetische Operatoren (Add, Sub, Mul, Div, Mod)
Grundlegende mathematische Funktionen (Runden, Untergrenze, Obergrenze)
String-Vergleiche
startsWith
substringof
Eq
Ne
endsWith replace substring tolower toupper trim concat
Datums- und Uhrzeitfunktionen day() month() year() hour() minute() second() Operator „DateTimeRangesOverlap“
Abfrage, ob Datum-Zeit in ein wiederkehrendes Datum-Zeit-Muster fällt

Die folgende Abbildung zeigt unterstützte OData-Abfrageoptionen.

Zum Sortieren kann asc und desc verwendet werden!

Hilfreiche Links

Weiterführende Ressourcen zu OData-Filterabfragen im SharePoint REST-Dienst:

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

Weitere Beispiele

Die folgende Tabelle zeigt konkrete OData-Filterausdrücke mit Syntax und erwarteten Ergebnissen:

Select a range of values Copyfilter=Entry_No gt 610 and Entry_No lt 615Query on GLEntry service. Returns entry numbers 611 through 614. ..
And Copyfilter=Country_Region_Code eq 'ES' and Payment_Terms_Code eq '14 DAYS'Query on Customer service. Returns customers in Spain where Payment_Terms_Code=14 DAYS. &
Or Copyfilter= 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 than Copyfilter=Entry_No lt 610Query on GLEntry service. Returns entry numbers that are less than 610. <
Greater than Copyfilter= Entry_No gt 610Query on GLEntry service. Returns entry numbers 611 and higher. >
Greater than or equal to Copyfilter=Entry_No ge 610Query on GLEntry service. Returns entry numbers 610 and higher. >=
Less than or equal to Copyfilter=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. <>
endswith Copyfilter=endswith(VAT_Bus_Posting_Group,'RT')Query on Customer service. Returns all customers with VAT_Bus_Posting_Group values that end in RT. *
startswith Copyfilter=startswith(Name, 'S')Query on Customer service. Returns all customers names beginning with “S”.
substringof Copyfilter=substringof(Name, ‘urn’)Query on Customer service. Returns customer records for customers with names containing the string “urn”.
length Copyfilter=length(Name) gt 20Query on Customer service. Returns customer records for customers with names longer than 20 characters.
indexof Copyfilter=indexof(Location_Code, ‘BLUE’) eq 0Query on Customer service. Returns customer records for customers having a location code beginning with the string BLUE.
replace Copyfilter=replace(City, 'Miami', 'Tampa') eq 'CODERED'
substring Copyfilter=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.
tolower Copyfilter=tolower(Location_Code) eq 'code red'
toupper Copyfilter=toupper(FText) eq '2ND ROW'
trim Copyfilter=trim(FCode) eq 'CODE RED'
concat Copyfilter=concat(concat(FText, ', '), FCode) eq '2nd row, CODE RED'
day Copyfilter=day(FDateTime) eq 12
month Copyfilter=month(FDateTime) eq 12
year Copyfilter=year(FDateTime) eq 2010
hour Copyfilter=hour(FDateTime) eq 1
minute Copyfilter=minute(FDateTime) eq 32
second Copyfilter=second(FDateTime) eq 0
round Copyfilter=round(FDecimal) eq 1
floor Copyfilter=floor(FDecimal) eq 0
ceiling Copyfilter=ceiling(FDecimal) eq 1

 

Sie sehen gerade einen Platzhalterinhalt von Facebook. Um auf den eigentlichen Inhalt zuzugreifen, klicken Sie auf die Schaltfläche unten. Bitte beachten Sie, dass dabei Daten an Drittanbieter weitergegeben werden.

Mehr Informationen

Sie sehen gerade einen Platzhalterinhalt von Instagram. Um auf den eigentlichen Inhalt zuzugreifen, klicken Sie auf die Schaltfläche unten. Bitte beachten Sie, dass dabei Daten an Drittanbieter weitergegeben werden.

Mehr Informationen

Andreas Olbricht
Dein Ansprechpartner
OIT GmbH
Profil ansehen

Hast du eine Frage zu diesem Artikel?

Schreib uns – wir antworten in der Regel innerhalb eines Werktages.