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

Package detail

@pnp/nodejs

pnp29.1kMIT4.17.0TypeScript support: included

pnp - provides functionality enabling the @pnp libraries within nodejs

readme

PnPjs is a fluent JavaScript API for consuming SharePoint and Microsoft Graph REST APIs in a type-safe way. You can use it with SharePoint Framework, Nodejs, or JavaScript projects. This an open source initiative complementing existing SDKs provided by Microsoft.

Please use http://aka.ms/community/home for the latest updates around the whole Microsoft 365 and Power Platform Community(PnP) initiative.

If you are moving from v2 please review the transition guide

Getting Started

Please see the Getting Started guide in the main documentation.

Documentation

Please review the documentation for the PnPjs libraries. This site is updated with each release. If cannot find what you need, please let us know by logging an documentation request.

Authors

This project's contributors include Microsoft and community contributors. Work is done as an open source community project.

Sponsors

We want to thank everyone that has sponsored us once or on an ongoing basis. We use the money to look for fun ways to invest in the growth of PnPjs. Thank you to each and every one of you for your support and belief in what we are doing!

Thank You

KEMiCZA Sympraxis Consulting thechriskent erwinvanhunen PopWarner VesaJuvonen LauraKokkarinen ricardocarneiro andrewconnell YannickRe jansenbe tdwhite0 wobba

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.

Supportability and SLA

This library is open-source and community provided library with active community providing support for it. This is not Microsoft provided module so there's no SLA or direct support for this open-source component from Microsoft. Please report any issues using the issues list.

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.

4.17.0 - 2025-Oct-20

Documentation and package updates.

-sp

  • Fixed #3309: File checkin() fails when comment has special characters in it

4.16.0 - 2025-Aug-11

Documentation and package updates only.

4.15.0 - 2025-Jul-14

  • sp

    • Small fix for addChunked for small files.
  • graph

    • Fix issues with addCopyFromContentTypeHub returning queryable and header for polling api

4.14.0 - 2025-Jun-9

  • sp
    • Update addChunked with chunkSize param

4.13.0 - 2025-May-12

  • Documentation and package updates only

4.12.0 - 2025-Apr 14

  • Windows 11 introduces an issue with the use of nodejs Spawn when not run through Shell. Updating Spawn Methods where needed to include shell:true.

4.11.0 - 2025-Mar-17

  • Update of presets/all

4.10.0 - 2025-Feb-19

  • graph

    • Implemented "Workbook" package
    • Updates batching logic for sp and graph to remove unnecessary reject carry for the send promise.
  • sp

    • Adding create change token util method to sp
    • Fixed issue when moving list instead of subfolder
    • Fix content-type order type on folder
    • Adds support for sp batches to auto-split if there are too many items in the batch
    • Updates batching logic for sp and graph to remove unnecessary reject carry for the send promise.

4.9.0 - 2025-Jan-15

  • graph
    • Added new drive endpoint to lists, which will get you drive information

4.8.0 - 2024-Dec-23

  • graph

    • Fixed issue with resumableUpload
  • nodejs

    • Removed node-fetch as minimum supported NodeJS version support native fetch.
  • queryable

    • reversed removal of .clone()

4.7.0 - 2024-Nov-18

  • sp

    • Introduces new filter lamda patterns as beta
  • graph

    • Renamed OneNote Pages to OneNotePages
    • Basic Pages API support as beta
    • Site Open Extensions as beta
    • Fixed #3136 for improving paging support for query params
  • queryable

    • Introduced DebugHeaders behavior

4.6.0 - 2024-Oct-14

  • Only documentation and package updates

4.5.0 - 2024-Sept-16

  • Only documentation and package updates

4.4.0 - 2024-Aug-12

  • sp

    • Addresses #3091 - Update return types from Shares
    • Addresses #3104 - Replaces an in-function await to just return the promise.
  • graph

    • Addresses #3083 - Adds the ability to pass in retrieveProperties to getAllChildrenAsTree. V2 and V3 had this functionality. Only supports Shared Custom Properties, not Local Custom Properties.

4.3.0 - 2024-July-15

  • sp

    • Addresses #3082 - Improves functionality of alias parameters
  • graph

    • Adds new AdvancedQuery behavior

4.2.0 - 2024-June-17

  • Only documentation and package updates

4.1.1 - 2024-June-05

Fixed

  • graph
    • Fixed batching issues that fails when batched call returns 204

4.1.0 - 2024-May-24

Fixed

  • graph
    • Update to better handle graph default url logic

4.0.1 - 2024-Apr-23

Fixed

  • graph
    • Fixed issue with SPFx behavior null check #3012

4.0.0 - 2024-Apr-22

Added

  • graph

    • explicit error thrown if SPFx context is null or undefined when needed
    • followed sites support for users
    • ISite now supports async rebase() to ensure any ISite is represented by the url pattern /sites/{site id} regardless of how it was first loaded
    • ISites.getAllSites()
    • support for operations for ISite and IList
    • support for file labels
    • support for mail folders, mailbox, rules
    • completed support for Files
    • admin module
    • analytics module
    • appCatalog module
    • compliance module
    • list-item module
    • mail module
    • operations module
    • permissions module
    • places module
    • taxonomy module
    • to-do module
  • sp

    • explicit error thrown if SPFx context is null or undefined when needed
    • getStream method on all readable files
    • addChunked updated to accept stream as content, new signature with props object

Removed

  • queryable

    • removed extension capabilities from core library
  • graph

    • paged method removed from IGraphQueryableCollection
    • ./operations.ts methods moved to ./graphqueryable.ts
    • deprecated DriveItem move method.
    • deprecated DriveItem setContent method.
    • data & [queryable] property on add/update methods -- now returns only a representation of the added/updated object
  • sp

    • getPaged method removed from _Items/IItems
    • getAll method removed from _Items/IItems
    • PagedItemCollection removed from library
    • removed /items/get-all import, unneeded, use async iterator patterns
    • ./operations.ts methods moved to ./spqueryable.ts
    • startUpload, continueUpload, finishUpload File protected methods removed
    • removed legacy support for @target query param
    • removed "favorites", please use graph favorites
    • taxonomy module, please use graph taxonomy
    • data & [queryable] property on add/update methods -- now returns void
  • nodejs

    • removed stream extensions, moved into sp

Changed

  • tsconfig.json

    • set preserveConstEnums: false
  • buildsystem

    • Rewritten using Timeline
    • Updated to v4
  • testing

    • SPA application now has a button to trigger the code vs running on page load
  • msaljsclient

    • updated to use @azure/msal-browser v3
  • queryable

    • moved add-props.ts and request-builders.ts to index.ts
    • Changed interface for query property
  • graph

    • IGraphQueryableCollection now supports async iterator pattern
    • IGraphQueryableCollection count method now returns -1 if the collection does not support counting
    • All GraphQueryable, _GraphQueryable, and IGraphQueryable* have been renamed to remove "Queryable" (ex: GraphQueryableCollection is now GraphCollection)
    • @pnp/graph/onedrive renamed to @pnp/graph/files
    • ISites.getByUrl is now async
    • @pnp/graph/outlook is now in @pnp/graph/mail, included all mail endpoints
    • mailCategory.add() returns Microsoft Graph types OutlookCategory vs object with data property.
    • Changed how query params are parsed to custom logic
    • Improvements to shared module
    • Greatly expanded what is supported through teams module
  • sp

    • _Items and IItems now supports async iterator pattern
    • chunked upload/add progress object shape changed to : { uploadId: string; stage: "starting" | "continue" | "finishing"; offset: number; }