Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
gd-sprest
Advanced tools
An easy way to develop against the SharePoint REST api.
This library is still being tested...
A global flag is used to determine if an app web request should execute requests against the host web. The host web will default to the SPHostUrl query string value. Note - This value is false by default
$REST.DefaultRequestToHostWebFl = true;
All objects have the following constructors [Object] and [Object]_Async.
Asynchronous Request
new Web_Async(function(web) { ... });
Synchronous Request
var web = new Web();
A global flag is used to determine if the request should be executed on creation. This option can save a request to the server. Note - This value is true by default.
$REST.ExecuteOnCreationFl = false;
Having the execute on creation boolean option, if set to false will construct the url of the base object without making a request to the server.
// This will create the web object, but not execute the request.
var web = new $REST.Web(false);
// This will execute the request to create a list
var list = web.addList({
BaseTemplate: 100,
Description: "This is a test list.",
Title: "Test"
});
// This will create the web object, set the asynchronous flag and not execute a request to the server
(new $REST.Web_Async(false))
// This will execute a request to the server to create a list
.addList({
BaseTemplate: 100,
Description: "This is a test list.",
Title: "Test"
})
// This will execute after the list is created
.done(function(list) {
// Additional code goes here
});
// This will execute one request to the server to get list items
// new $REST.ListItems("[List Name]", "[View XML or CAML Query]");
// The query will default the parent to "<View>"
new $REST.ListItems("Site Assets", "<Query><Where><Gt><FieldRef Name='ID' /><Value Type='Integer'>0</Value></Gt></Where></Query>");
new $REST.ListItems("Site Assets", "<View Scope='RecursiveAll'><Query><Where><Eq><FieldRef Name='FileLeafRef' /><Value Type='File'>sprest.js</Value></Eq></Where></Query></View>");
All constructors take have the following optional parameters:
// The target information and execute request flags are optional
new Object([Object Specific Input Parameters], executeRequestFl);
new Object([Object Specific Input Parameters], targetInfo);
new Object([Object Specific Input Parameters], targetInfo, executeRequestFl);
// Asynchronous methods can take either a target information object, or the callback function
new Object_Async([Object Specific Input Parameters], targetInfo, executeRequestFl);
new Object_Async([Object Specific Input Parameters], function(obj) { ... }, executeRequestFl);
The target information consists of the following properties:
The executeRequestFl parameter will default to the global $REST.ExecuteOnCreationFl value.
Since the library can be executed synchronously, the user can execute commands in the browser's console window and interact with the SharePoint site in a command-line interface.
Note - The commands will execute under the security of the current user. Note - SharePoint online may reject synchronous requests. It's better to use asynchronous requests.
To test this library, upload the test folder contents to a SharePoint library and access to the "test.aspx" page. This will test the basic functionality of the library.
Refer to the test script file for detailed examples of using the library.
Note - The examples below will execute one request to the server.
List
new $REST.ContentTypes("Document", "documents");
Web
new $REST.ContentTypes("Document");
List
new $REST.ContentTypes("documents");
Web
new $REST.ContentTypes();
List
new $REST.Fields("Title", "documents");
Web
new $REST.Fields("Title");
List
new $REST.Fields("documents");
Web
new $REST.Fields();
List
new $REST.File("sprest.js", "documents");
Web
new $REST.File("/sites/dev/shared documents/sprest.js");
List
new $REST.Files("documents");
Web
new $REST.Files();
List
new $REST.Folder("sprest.js", "documents");
Web
new $REST.Folder("/sites/dev/shared documents/sprest.js");
List
new $REST.Folders("documents");
Web
new $REST.Folders();
new $REST.List("documents");
new $REST.Lists();
new $REST.ListItems(1, "documents");
All Items
new $REST.ListItems("documents");
CAML Query
new $REST.ListItems("documents", "<Query><Where><Gt><FieldRef Name='ID' /><Value Type='Integer'>0</Value></Gt></Where></Query>");
List
new $REST.RoleAssignments("documents");
Web
new $REST.RoleAssignments();
new $REST.RoleDefinitions();
new $REST.Site();
new $REST.SiteGroups();
Site
new $REST.UserCustomActions();
Web
new $REST.UserCustomActions(true);
new $REST.Users();
new $REST.View("all items", "documents");
new $REST.Views("documents");
new $REST.Web();
FAQs
An easy way to develop against the SharePoint REST API.
The npm package gd-sprest receives a total of 1,248 weekly downloads. As such, gd-sprest popularity was classified as popular.
We found that gd-sprest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.