lunes, 29 de julio de 2013

SharePoint REST interface with operators and functions

Introduction

What information the article has
  • various operators that can be used with REST interface
  • various functions that can be used with REST interface

Skill Level – Medium

Filter operators

Following are the various filter operators that can be used with REST interface
eq Equal to
ne Not equal to
gt Greater than
ge Greater than or equal to
lt Less than
le Less than or equal to
and Logical and
or Logical or
not Logical negation
add Addition
sub Subtraction
mul Multiplication
div Division
mod Modulo
( ) Precedence grouping

Functions

Following are the various functions that can be used with REST interface
bool substringof(string s0, string s1)
Checks whether s0 is within s1
bool endswith(string s0, string s1)
Checks whether s0 ends with s1
bool startswith(string s0, string s1) 
Checks whether s0 starts with s1
int length(string s)
Length of string s
int indexof(string s0, string s1)
Index of string s0 within s1
string insert(string s0, int pos, string s1)
Inserts s0 into s1 at position pos.
string remove(string s0, int pos)
Removes characters from position pos in s0
string remove(string s0, int pos, int length)
Removes length characters from position pos in s0
string replace(string s0, string f0, string s1)
Replaces f0 in s0 with s1
string substring(string s0, int pos)
Returns the substring from position pos in s0
string substring(string s0, int pos, int length)
Returns the substring from position pos in s0 with the length characters
string tolower(string s0)
Transforms s0 to lowercase
string toupper(string s0)
Transforms s0 to uppercase
string trim(string s0)
Removes leading and trailing whitespaces
string concat(strings s0, string s1)
Concatenates two strings
int day(DateTime dt)
Day of the date dt
int hour(DateTime dt)
Hour of the date dt
int minute(DateTime dt)
Minute of the date dt
int month(DateTime dt)
Month of the date dt
int second(DateTime dt)
Second of the date dt
int year(DateTime dt)
Year of the date dt
double round(double dbl)
Rounded value of dbl with double precision
decimal round(decimal dec)
Rounded value of dec with decimal precision
double floor(double dbl)
Floor value of dbl with double precision
decimal floor(decimal dec)
Floor value of dec with decimal precision

Examples of usage

/Employees?$filter=Id eq 1
Filter using the eq operator extracts exactly one element if the filtered element is unique
Employees?$filter=’Jac,Arth’ eq concat(FirstName, concat(‘,’, LastName))
Filter after concatinating the column values
Employees?$filter=year(Modified) eq 2010
Filter on the year of the Modified property
Employees?$filter=Id eq 3 and substring(Department, 0, 1) eq ‘I’
Filter on the result set along with expression

Conclusion

REST interface is a great way of accessing SharePoint data and hope the above operators and functions will give grater ability

No hay comentarios:

Publicar un comentario