.select()
can take a string property, an array of strings or you can pass in each value as a separate argument.
try{// Below three statements are sameletres1=awaitclient.api("/me/people").select("displayName").select("department").get();letres2=awaitclient.api("/me/people").select("displayName","department").get();letres3=awaitclient.api("/me/people").select(["displayName","department"]).get();}catch(error){throwerror;}
.expand()
can take a string property, an array of strings or you can pass in each value as a separate argument.
try{// Below three statements are sameletres1=awaitclient.api("/me/people").expand("manager").expand("directReports").get();letres2=awaitclient.api("/me/people").expand("manager","directReports").get();letres3=awaitclient.api("/me/people").expand(["manager","directReports"]).get();}catch(error){throwerror;}
.orderby()
can take a string property, an array of strings or you can pass in each value as a separate argument.
try{// Below three statements are sameletres1=awaitclient.api("/me/messages").orderby("name").orderby("subject").get();letres2=awaitclient.api("/me/messages").orderby("name","subject").get();letres3=awaitclient.api("/me/messages").orderby(["name","subject"]).get();}catch(error){throwerror;}
.top()
can take only a number as a parameter. Calling it multiple times is not supported.
try{letres=awaitclient.api("/me/contacts").top(5).get();console.log(res);}catch(error){throwerror;}
.skip()
can take only a number as a parameter. Calling it multiple times is not supported.
try{letres=awaitclient.api("/me/events").skip(10).get();console.log(res);}catch(error){throwerror;}
Set .count()
to true to additionally return the number of objects in the collection.
try{letres=awaitclient.api("/me/calendars").count(true).get();console.log(res);}catch(error){throwerror;}
Pass a filter string to .filter()
for filtering result collections. Calling filter multiple times will override previous filter strings.
try{letres=awaitclient.api("/users").filter("startswith(displayName, 'dicaprio')").get();console.log(res);}catch(error){throwerror;}
Pass a search string to .search()
to restrict the results of a request to match a search criterion. Calling search multiple times will override previous search strings.
try{letres=awaitclient.api("/me/people").search("dicaprio").get();console.log(res);}catch(error){throwerror;}