gd-sprest 2.2.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package gd-sprest --version 2.2.5
NuGet\Install-Package gd-sprest -Version 2.2.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="gd-sprest" Version="2.2.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add gd-sprest --version 2.2.5
#r "nuget: gd-sprest, 2.2.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install gd-sprest as a Cake Addin
#addin nuget:?package=gd-sprest&version=2.2.5

// Install gd-sprest as a Cake Tool
#tool nuget:?package=gd-sprest&version=2.2.5

NuGet Current Version Downloads Total Downloads Gitter chat Donate

SharePoint Online/On-Premise REST Framework

Overview:

The SharePoint REST Framework was designed for SharePoint 2013, but works in both SharePoint 2013/2016 and Office 365. This framework is designed to remove the overhead of SharePoint development, allowing the developer to focus on the client requirements. A reference to the associated github projects are listed below:

gd-sprest vs pnp-js-core

The gd-sprest library is similar to the pnp-js-core, with the main difference being the ability to be used within the browser console window. This feature provides a "Powershell-Like" experience within the browser console window. Some reasons to use this functionality:

  • No access to the server farm
  • Ability to create scripts which can be tested in staging before running aginst production
  • For more efficient development of code, the developer has the ability to test code requests without having to deploy the solution
  • Easy way to perform research and development by exploring the REST API with the available intellisense

Bugs/Feature Requests/Help

Click Here to report any bugs, request any new features or if need help with code examples. Pull requests are welcomed for anyone interested in submitting them. Feel free to email for other questions.

Security

The REST api execute requests based on the user's permissions. There is no way to elevate priviledges requests against the SharePoint REST.

Get Started

Packages

NPM

Add the npm package to your project:

npm --save install gd-sprest
Yarn

Add the package from yarn:

yarn add gd-sprest

Code Examples

JavaScript
var $REST = require("gd-sprest");

// Get the current web and lists
$REST.Web().query({
    Expand: ["Lists"]
}).execute(function(web) {
    // Parse the lists
    for(var i=0; i<web.Lists.results.length; i++) {
        var list = web.Lists.results[i];
    }
});
NodeJS
const $REST = require("gd-sprest);

// Create a new generic list.
request = $REST.Web("https://dev.sharepoint.com")
    .Lists().add({
        BaseTemplate: $REST.SPTypes.ListTemplateType.GenericList,
        Title: "New List"
    });

// Log the request information
console.log(request.getInfo());

// Console Output:
// {
//     data: '{"BaseTemplate":100,"Title":"New List","__metadata":{"type":"SP.List"}}',
//     method: 'POST',
//     url: 'https://dev.sharepoint.com'
// }
TypeScript
import { List }

// Get the "Site Assets" library, fields and views
(new List("Site Assets"))
    // Query the list
    .query({
        Expand: ["Fields", "Views"]
    })
    // Execute the request
    .execute((list) => {
        // Parse the fields
        for(let i=0; i<list.Fields.results.length; i++) {
            let field = list.Fields.results[i];
        }

        // Parse the views
        for(let i=0; i<list.Views.results.length; i++) {
            let field = list.Views.results[i];
        }
    });

Development

Add-In Model

The add-in model uses the app web for SharePoint Hosted Apps/Add-Ins. The provider hosted model would use CSOM, and not this library. This framework has built-in helper methods and a global flag for determining which web the request should execute against Host vs App/Add-In. The request will be automatically updated based on the target web, so there is no additional code required from the developer. This allows the developer to create a single source of code that works against both the SharePoint and App/Add-In webs.

Available Libraries

import {
    $REST,
    ContextInfo,
    Email,
    Helper,
    JSLink,
    List,
    PeopleManager,
    PeoplePicker,
    ProfileLoader,
    RequestType,
    Search,
    Site,
    SocialFeed,
    SPTypes,
    Types,
    UserProfile,
    Web
} from "gd-sprest";

Automation

The "SharePoint Configuration" class allows the developer to define configuration files for the SharePoint solution. This class contains built-in methods for execution (install, uninstall, etc), so there is no need to write additional code.

Intellisense

One of the more important features of this framework is the intellisense. The classes have been setup to ensure the developer does not need to define the output type of the request. The "Types" and "SPTypes" classes can both be imported into the project. The "Types" class includes allows of the interfaces available in the library. The "SPTypes" class contains all of the enumerators in SharePoint. These interfaces can be used to provide intellisense for the custom variables.

Modern Experience in SharePoint 2013

The gd-sprest-react library contains SharePoint components:

  • Field
  • Item Form
  • Panel
  • People Picker
  • WebParts These components use the office fabric ui, to provide an Office 365 experience within SharePoint 2013.
Upgrade Path to SharePoint Framework

The react components developed for SharePoint 2013 can be ported over to the SharePoint Framework's modern webpart.

WebParts

The webpart component allows the developer to easialy assign react components to be rendered based on the page's state (Display/Edit). This component currently supports webpart, publishing and wiki pages. The following webpart components are available:

  • Configuration - A react component to be used when the page is being edited, displaying an "Edit Configuration" button to render a panel for custom webpart properties.
    • List Configuration - Inherits the configuration webpart, displaying a web url and list dropdown.
    • Field Configuration - Inherits the list configuration webpart, adding a field picker.
    • Search Configuration - Inherits the field configuration webpart, filtering the field picker to field types supported by the search webpart.
  • List - Allows the developer to define an OData or CAML query, and contains two methods:
    • onRenderContainer - Optional method with the query results passed as the input parameter.
    • onRenderItem - Requires method with the item result passed as the input parameter.
  • Search - Inherits the list webpart, adding a search textbox. Based on the configuration fields, a mapper is created based on the item data. This feature will automatically filter the items displayed.
  • Tabs - Displays all associated webparts within the same zone in tabs.
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETFramework 4.5

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.4.9 467 6/24/2021
6.4.7 343 5/12/2021
6.3.4 332 2/14/2021
6.2.5 472 12/19/2020
6.1.4 423 10/16/2020
6.1.2 435 10/7/2020
6.1.0 453 9/28/2020
6.0.9 421 9/26/2020
6.0.2 420 8/5/2020
6.0.0 434 7/29/2020
5.9.8 441 7/24/2020
5.9.6 515 7/23/2020
5.9.3 420 7/22/2020
5.9.2 483 7/22/2020
5.9.0 460 7/14/2020
5.8.4 516 7/3/2020
5.8.2 437 6/17/2020
5.7.5 540 5/31/2020
5.7.3 524 5/28/2020
5.6.9 452 5/18/2020
5.6.6 486 5/15/2020
5.5.8 441 5/5/2020
5.5.6 487 5/1/2020
5.5.4 497 4/29/2020
5.5.3 462 4/25/2020
5.5.0 484 4/21/2020
5.4.5 577 4/12/2020
5.4.0 521 4/8/2020
5.3.8 575 4/4/2020
5.3.7 482 3/27/2020
5.3.6 524 3/26/2020
5.3.5 502 3/25/2020
5.3.4 490 3/25/2020
5.3.3 533 3/24/2020
5.3.2 509 3/24/2020
5.3.1 611 3/22/2020
5.2.7 516 3/22/2020
5.2.6 612 2/27/2020
5.2.3 528 2/11/2020
5.2.2 495 2/10/2020
5.2.1 534 1/28/2020
5.1.9 664 1/25/2020
5.1.3 575 12/16/2019
5.0.8 513 11/24/2019
5.0.6 525 11/19/2019
5.0.5 505 11/17/2019
4.9.9 547 9/21/2019
4.9.2 584 8/25/2019
4.9.1 563 8/23/2019
4.9.0 553 8/21/2019
4.8.9 533 8/20/2019
4.8.7 595 6/14/2019
4.8.5 589 6/11/2019
4.8.2 683 4/22/2019
4.8.1 637 4/21/2019
4.7.9 590 4/18/2019
4.7.5 583 3/3/2019
4.7.4 586 3/2/2019
4.6.8 663 2/19/2019
4.6.4 691 2/7/2019
4.5.3 676 1/27/2019
4.5.2 682 1/21/2019
4.4.8 706 1/20/2019
4.4.6 752 1/20/2019
4.4.3 732 12/13/2018
4.4.2 737 12/12/2018
4.3.8 726 12/1/2018
4.3.7 691 11/11/2018
4.3.4 712 10/25/2018
4.2.7 763 9/26/2018
4.1.8 852 8/14/2018
4.1.6 855 7/23/2018
4.1.5 942 7/19/2018
4.1.4 956 7/17/2018
4.1.3 836 7/17/2018
4.1.2 945 7/13/2018
4.0.4 938 6/20/2018
3.9.1 1,017 4/29/2018
3.8.9 944 4/23/2018
3.8.6 953 4/18/2018
3.7.7 993 4/2/2018
3.6.4 973 3/17/2018
3.6.2 1,018 3/16/2018
3.6.0 923 3/15/2018
3.5.5 1,025 3/9/2018
3.5.3 993 3/8/2018
3.4.8 993 2/13/2018
3.4.1 963 2/7/2018
3.3.3 974 2/4/2018
3.2.3 882 1/28/2018
3.2.0 1,095 1/25/2018
2.5.9 1,100 1/10/2018
2.3.0 1,098 12/8/2017
2.2.8 963 12/2/2017
2.2.5 1,266 11/19/2017
2.2.4 1,250 11/5/2017
0.0.3 1,297 11/5/2017
0.0.2 1,333 11/5/2017
0.0.1 1,007 11/5/2017

Initial nuget package test.