Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@pnp/pnpjs

pnp5kMIT2.15.0TypeScript support: included

pnp - rollup library of all functionality

readme

SharePoint Patterns and Practices

The SharePoint Patterns and Practices client side libraries were created to help enable developers to do their best work, without worrying about the exact REST api details. Built with feedback from the community they represent a way to simplify your day-to-day dev cycle while relying on tested and proven patterns.

Please use http://aka.ms/sppnp for the latest updates around the whole SharePoint Patterns and Practices (PnP) initiative.

Source & Docs

This code is managed within the main pnp repo, please report issues and submit pull requests there.

Please see the public site for package documentation.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

"Sharing is Caring"

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

2.15.0 - 2022-Dec-9

Fixed

  • all: Now using the newer adal-node version (0.2.3) to fix issue #2496

2.14.0 - 2022-Jul-12

2.13.0 - 2022-Mar-11

2.12.0 - 2022-Feb-11

Fixed

2.11.0 - 2021-Nov-15

Fixed

  • sp: Fix setStreamContentChunked with v3 code #1914; ICommentInfo as Partial #1933 @patrick-rodgers [PR]

Added

Changed

2.10.0 - 2021-Oct-15

Fixed

  • docs: fixed incorrect example in role definition @Abderahman88 [PR]
  • graph: fixed bug with double quotes in search query @juliemturner
  • sp: fixed bugs #1847, #1871 issue with setting images in web part and banner @juliemturner

2.9.0 - 2021-Sept-20

Fixed

  • graph: Fixes the $count query param by adding appropriate header @JakeStanger [PR]

2.8.0 - 2021-Aug-13

Fixed

  • sp: Removed a call to .clone affecting batches in some cases #1837 @patrick-rodgers [PR]
  • sp: fixes sharing for files, fixes bug in shareObject code path #1827 @patrick-rodgers [PR]
  • docs: missing imports on OneDrive imports @omarelanis [PR]
  • graph: Fixes add in DriveItems @patrick-rodgers [PR]
  • sp: ClientSide Pages: Always includes BannerImageUrl in save page payload to avoid null #1847 @juliemturner

Added

  • graph: Adds the $search query param for messages, people and directory objects @JakeStanger [PR]
  • graph: Adds new function to events to get all instances. @JakeStanger [PR]
  • sp: Add fields.addImageField, listitem.setImageField, item.getParentInfos returns "ParentList/Title" @patrick-rodgers [PR]
  • graph: Adds addFolder to DriveItems @patrick-rodgers [PR]

2.7.0 - 2021-July-09

Fixed

  • docs: Optional params for lists renderListDataAsStream #1811, fix bad example for roleAssignments.remove #1820 @patrick-rodgers [PR]

2.6.0 - 2021-June-11

Fixed

Added

Changed

  • sp: Check if CorporateCatalogUrl before returning Web @allanhvam [PR]
  • docs: Added examples showing how to access a term set @mrebuffet [PR]

2.5.0 - 2021-May-14

Fixed

  • sp: sp.site.getContextInfo() compatible with SP2013 @lukju [PR]
  • docs: fixed typeo in Files/types.ts @AriGunawan [PR]
  • docs: fixed typeo in debug-tests.md @chimenjoku [PR]
  • sp: Fix getting content type name in the proper language @magarma [PR]
  • sp: searchUsingCaching where results shared a cache key so were not being updated #1678 @patrick-rodgers [PR]
  • sp: Fixed issues with isolated runtimes not inheriting properly #1755 @patrick-rodgers [PR]

Added

Changed

2.4.0 - 2021-April-9

Fixed

Added

  • graph: Added Graph User Presence endpoint & unit test fixes @juliemturner [PR]

Changed

  • docs: Documentation Update Multi-line Text Field - Enhanced Rich Text @juliemturner [PR]

2.3.0 - 2021-March-12

Fixed

Added

Changed

2.2.0 - 2021-Feb-12

Fixed

Added

  • docs: Added missing addNumber() method to IFields documentation @gitbrent [PR]

2.1.1 - 2021-Feb-01

Changed

  • sp: Updated docs to cover setting properties for clientside webparts @patrick-rodgers [PR]

Fixed

  • sp: Fix issue with isolated runtimes and global headers @tavikukko [PR]
  • sp: Fix issue with clientside-page like/unlike @juliemturner [PR]
  • sp: Fix for taxonomy getAllChildrenAsOrderedTree method for terms without ordering information @patrick-rodgers [PR]
  • sp: Fix for setProxyUrl not using configured setting for some auth tasks @patrick-rodgers [PR]

2.1.0 - 2021-Jan-15

Added

  • sp: Adds addChunked stream version for node @koltyakov [PR]
  • general: Push tags on release #1484 @pdecat [PR]
  • general: Isolated Runtimes for sp and graph + node module updates @patrick-rodgers [PR]
  • graph: Graph search, getListItemEntityTypeFullName caching, and dev deps updates @patrick-rodgers [PR]

Changed

Fixed

2.0.13 - 2020-Dec-14

Added

Changed

  • docs: Updated SPFx On-Prem & TypeScript (alternative) docs @koltyakov [PR]
  • sp: Add NextHref prop in IRenderListDataAsStreamResult @Leomaradan [PR]

Fixed

2.0.12 - 2020-Nov-16

Added

  • sp: Adds new ClientSidePage.setBannerImageFromExternalUrl #1396 [PR]
  • sp: Adds new getParentInfos to List, Folder, and Items [PR]
  • sp: Adds ability to work with very large libraries with > 5000 files to Files.addChunked method #1424

Changed

  • sp: Updates ClientSideText adding additional <p></p> tags which are no longer needed. #1282 [PR]
  • sp: Updates Folder methods (moveTo, moveByPath, copyTo, copyByPath) to remove dependency on odata.id. #1395 @hohenp [PR]

Fixed

  • sp: Fixes issue renderListDataAsStream not passing in URL parameters #1414 [PR]
  • graph: Fixes issue with multiple graph methods not honoring 'inBatch' #1411 [PR]
  • sp: Fixes folder default values at library just working for first default value #1434 @tavikukko [PR]
  • sp: Fix for issue setting taxonomy field default values for libs/folders #1426 @tavikukko [PR]

2.0.11 - 2020-Oct-09

Added

  • docs/sp: Address underlying api issue in #1383 by adding known issue tag @juliemturner [PR]
  • node: Adds support for node MSAL client with docs, Likely addresses #1226 as well with introduction of modern msal support #1390 [PR]
  • sp: Use string values for the BasePermission High and Low properties in SP RoleDef updates @danwatford [PR]

Changed

  • docs/sp & graph: update taxonomy for change in beta endpoints #1359, #1378 & graph update for photos endpoint #1368 @juliemturner [PR]
  • docs/graph: Update docs for calendars, contacts, directoryobjects, insights, invitations, onedrive, planner. Update @microsoft/microsoft-graph-types to 1.22.0 @juliemturner [PR]

Fixed

  • docs: Fix Microsoft 365 PnP logo @thechriskent [PR]
  • sp: Fixes issue with ViewsLifeTime search property casing in name #1401 [PR]

2.0.10 - 2020-Sept-10

  • packaging: update to include .map files in packages [PR]
  • docs: update to docs for nodejs sp extensions [PR]
  • sp: update how batch error handling is done [PR]
  • nodejs: fix for nodejs-commonjs error in 2.0.9 [PR]
  • odata: updates how extensions are managed when extending a factory [PR]

2.0.9 - 2020-Sept-04

Added

  • sp: Added support for deleteWithParameters for folder, file, and item [PR]
  • sp: Adding support for file.Exists to handle errors #1320 [PR]
  • sp: Adding support for AddSubFolderUsingPath #1340 [PR]
  • nodejs: Add getStream support to Nodejs @naugtur [PR]

Changed

  • Renaming all instances of master to main in scripts, docs, and code [PR]
  • sp: Updates to adjust taxonomy support and docs to reflect changes in api [PR]

Fixed

  • docs/graph: Docs updates to address #1341, #1099, and updated graph typings version to 1.17.0 @juliemturner [PR]
  • sp: Fixes an issue for users not using minimal meta-data where unpatched 2016 returns verbose results that caused an error in getParentWeb. [PR]
  • docs/graph: Updated documentation and added Graph tests @dcashpeterson [PR]
  • sp/graph: Bug fixes for #1337, #1349 @juliemturner [PR]
  • sp/graph: Fix for #1330, fixing linting issues, update tests for client side pages [PR]

2.0.8 - 2020-Aug-07

Added

  • sp: Added custom SPHttpClient extensibility and docs [PR]
  • graph: Added baseUrl [PR]
  • graph: Added ability to pass the SPFx context directly to setup [PR]
  • docs: Added article on library configuration [PR]

Changed

  • msal: Fixed type name spelling @biste5 [PR]

Fixed

  • sp: Fixed issue with renderListDataAsStream when omitting overrideParameters [PR]
  • docs: Various updates, improvements, and corrections @dcashpeterson [PR]

Removed

  • graph: Removed adaljslcient library dependency [PR]

2.0.7 - 2020-July-27

Added

  • graph: Added calendar endpoints and docs @JakeStanger [PR]
  • msaljsclient: Added a new client for MSAL in browser [PR]
  • docs: Added a new article on error handling [PR]
  • graph: Adds the calendarView method to calenders and users [PR]

Changed

  • docs: Moved contribution guide to its own section and expanded [PR]

Fixed

  • adaljsclient: Fixed bug in getToken @jusper-dk [PR]
  • sp: Fixed a bug in the role definition and graph planner task details when updating @juliemturner [PR]
  • docs: Updated attachments.md @cesarhoeflich [PR]
  • docs: Updated views.md @mikezimm [PR]
  • docs: Updated permissions.md @Harshagracy [PR]
  • docs: Fixed typos in comments-likes.md @NZainchkovskiy [PR]
  • sp: Fixed uri encoding for select, expand, and orderby query params [PR]
  • docs: Fixed typos in readme and docs/index.md @Ashikpaul [PR]
  • docs: Fixed clientsite-pages.md typos and wording to make more clear @MarkyDeParky [PR]
  • sp: Fixed code comment typo in queryable.ts @NZainchkovskiy [PR]
  • docs: Removed duplicate search menu item @f1nzer [PR]
  • graph: Made setEndpoint public, adds back user.photo property [PR]
  • sp: Fixed bug with setting profile photo [PR]
  • docs: Fixed typos in file attachment docs @juliemturner [PR]
  • docs: Fixed a typo in sites.md @ravichandran-blog [PR]
  • sp: Fixed issue updating certain field types due to non-matching type [PR]

2.0.6 - 2020-June-05

Added

  • sp: Adds read operations for v2.1 Taxonomy API [PR]
  • sp: Adds support for setting client side page description [PR]
  • sp: Adds support for setting client side page thumbnail [PR]

Fixed

2.0.5 - 2020-May-08

Added

  • graph: Added tests and docs for groups @dcashpeterson [PR]
  • sp: Added method to check it site collection exists @DRamalho92 [PR]
  • sp: Added suppot for setting banner image in clientside-page copy [PR]

Changed

  • sp: Made field type optional when updating a field [PR]
  • polyfills: Allow selective import of polyfills [PR]

Fixed

  • graph: Fixed issue with directoy-objects return types @juliemturner [PR]
  • docs: Updated graph teams article @jaywellings [PR]
  • docs: Fixed nav node name for users link @siddharth-vaghasia [PR]
  • sp: Fixed missing delete method on fields @tavikukko [PR]
  • sp: Fixed issue with search results if there are zero rows returned [PR]
  • common: Fixed storage issue in node related to usingCaching [PR]
  • sp: Fixed bug in searchWithCaching [PR]

2.0.4 - 2020-April-10

Added

  • graph: Added Graph Insights + documentation @simonagren [PR]
  • sp: Added support, docs, and tests for default column values [PR]
  • sp: Added support for setting clientside page author field [PR]
  • sp: Added support for executeSiteScriptAction on Site [PR]
  • sp: Added support for accessing title and description resource on Web, List, Content Type, Field, and User Custom Action [PR]
  • sp: Added support for additional site creation properties [PR]
  • sp: Added support for getFileByUrl method on web [PR]
  • sp: Added support to specify promoted state when creating or copying clientside pages [PR]

Fixed

  • sp: brought over a v1 change that was missed for getCurrentUserEffectivePermissions @koltyakov [PR]
  • graph: fixed graph planner bucket edit and delete with etag @JMTeamway [PR]
  • docs: Add starting '/' on relative urls in files & folders docs @joelfmrodrigues [PR]
  • sp: Fixed issue with absolute url when copy/moving files and folders by path @joelfmrodrigues [PR]
  • sp: Fixed issue with Retry-After not being converted to milliseconds @koltyakov [PR]
  • docs: Fixed imports for sp.profiles docs @joelfmrodrigues [PR]
  • docs: Fixed storage entities docs to correctly ref IStorageEntity @PaoloPia [PR]
  • docs: Replaced a TODO with proper content @hugoabernier [PR]
  • docs: Fixed fields documentation @AJIXuMuK [PR]
  • sp: Fixed code to support accessing a safe global object regardless of environment [PR]
  • docs: Fixed docs around comments imports [PR]
  • sp: Fixed issue with null emphasis object in clientside pages [PR]
  • docs: Added recycle method to docs for list item [PR]
  • graph: Fixed issues with batching parsing and improved error handling [PR]
  • docs: Fixed a bad link and replaced TODO's with content in web article [PR]

2.0.3 - 2020-Feb-14

Happy Valentine's Day ❤

Added

  • docs: added article on using odata debugging extensions [PR]
  • sp: added getFolderById and getFileById methods with tests and docs [PR]
  • graph: added people property to user [PR]
  • sp: added additional props to addValidateUpdateItemUsingPath method [PR]
  • sp & graph: added automatic retry on 504 errors @mrebuffet [PR]

Changed

  • docs: updated article on ie11 mode and polyfills [PR]

Fixed

  • graph: fix for missing eTag in update/delete @JMTeamway [PR]
  • sp: docs updates and export fixes for entity parsers [PR]
  • docs: fixed transition guide link [PR]
  • docs: expand article on using setBannerImage for clientside pages [PR]
  • graph: fixed team displayName property @RoelVB [PR]
  • docs: removed "src" in import path in site-users article @ValerasNarbutas [PR]
  • odata: fixed edge case affecting batch ordering [PR]
  • odata: fixed issue with core Proxy handler "has" operation [PR]
  • odata: updated interface to use I prefix, code cleanup [PR]

2.0.2 - 2020-Jan-23

Added

  • sp: added moveByPath and copyByPath to file and folder @joelfmrodrigues [PR]
  • buildsystem: added ability to include a distint "module" build into the packages [PR]

Changed

  • sp: added multiple render option capability to renderListDataAsStream [PR]

Fixed

2.0.1 - 2019-Jan-16

  • Unpublished due to module issues

2.0.0 - 2019-12-20

Added

  • odata: added IQueryableData
  • all: added tests for all methods/properties
  • all: added docs entries for all methods/properties
  • odata: extension methods
  • sp: added ability to add/retrieve comments directly from IClientsidePage

Changed

  • odata: refactor Queryable
    • removed withPipeline
    • removed the action methods (get, post, put, delete)
    • introduced "invokable" concept
    • added additional methods to operate on Queryables
    • all inheriting methods updated with interfaces and factory functions
    • remove ODataQueryable and merged into Queryable
    • created binding functions for invokables and operations
  • sp & graph: libraries can be selectively imported
  • all: updated internals to use await
  • all: interfaces prefixed with "I"
  • odata: an empty request pipeline now throws an error
  • sp & graph: updated clone to use factory methods
  • sp: changed signature of createDefaultAssociatedGroups
  • sp: all query string params are escaped within the library
  • tooling: gulp tasks rewritten in TypeScript, updated to latest
  • tooling: build system rewritten as cli
  • common: extend renamed to assign
  • sp: client side pages breaking changes in method signatures
  • sp: breaking change to rename search classes and factories
  • common: moved adalclient to @pnp/adaljsclient to reduce size of common

Removed

  • odata: removed "as" method from SharePoint & Graph Queryable
  • sp: removed WebInfos class
  • sp: removed InstalledLanguages class
  • sp: removed Web.addClientSidePageByPath
  • all: removed bundles from npm packages
  • tooling: removed gulp and replaced tasks with npm scripts
  • all: no longer building es5 code
  • common: removed getAttrValueFromString method