Questions tagged [pnp-js]

PnPjs is a collection of fluent libraries for consuming SharePoint, Graph, and Office 365 REST APIs in a type-safe way. You can use it within SharePoint Framework, Nodejs, or any JavaScript project.

PnPjs is a collection of fluent libraries for consuming SharePoint, Graph, and Office 365 REST APIs in a type-safe way. You can use it within SharePoint Framework, Nodejs, or any JavaScript project.

Getting Started

Install the library and required dependencies

npm install @pnp/sp --save

Import the library into your application and access the root sp object

import { sp } from "@pnp/sp";
import "@pnp/sp/webs";
import "@pnp/sp/lists";

// get the list by Id
const list = sp.web.lists.getById("03b05ff4-d95d-45ed-841d-3855f77a2483");

// we can use this 'list' variable to execute more queries on the list:
const r = await list.select("Title")();

// show the response from the server
console.log(r.Title);
146 questions
0
votes
1 answer

How to set selected values on ComboBoxListItemPicker? @pnp/spfx-controls-react

I'm struggling with this issue for a couple of days now, can you help me figure it out? I'm trying to set the selected items for the component but it just let me set the initial selected items, but I need to set it after it is created. I wish it had…
André Matos
  • 35
  • 1
  • 6
0
votes
2 answers

SPFx show list items in a drop down (Not in web-part property)

I am quite new to SPFx and trying to build a web part, In my web part I would have a Dropdown button and the Dropdown values would come from a SharePoint list. I want to use react and pnpjs. how do I achieve it?
0
votes
1 answer

Exporting a PPTX to PDF in Sharepoint Online with PnPjs and .pdfConversionUrl

We are interacting with Sharepoint Online's Document Library through the PnPjs framework and by using a Sharepoint App Add-In (We can't use Graph API at this time) Our add-in has full control of our site:
Mike T
  • 482
  • 1
  • 6
  • 16
0
votes
1 answer

Get changes on a list not working pnp-js Node Azure Function

Wondering if anyone else has an issue with the "@pnp/sp/lists" getChanges method. The following will not return any changes in my Node Azure Function: const changeQuery: IChangeQuery = { Add: true, ChangeTokenEnd: null, ChangeTokenStart:…
0
votes
1 answer

SharePoint AddIn, can't find "Style Library"? Language Issue

I have an AddIn that works fine to install in an English setup of Sharepoint. However, when I test this in another language I run into an issue. The issue is with this code: var list = web.get_lists().getByTitle("Style Library"); I get the error…
0
votes
1 answer

SharePoint SPFX: Unable to get property 'Context'

I'm working on a custom SPFX commandset. It opens a dialog with an iframe to an 3rth party platform. I'm able to receive a json through a postmessage. From this json, I convert it's data to a file, with it's proper metadata. All of this works like a…
Bryan van Rijn
  • 837
  • 10
  • 18
0
votes
1 answer

SharePoint SPFX: Is there a way to get a document library by it's url?

I was wondering if there is a way in SPFX to get the library by the current url? Lets say "/sites/CustomerSite/Shared%20Documents/Forms/AllItems.aspx"
Bryan van Rijn
  • 837
  • 10
  • 18
0
votes
1 answer

Error breaking role inheritance on SharePoint list item using PnPJS

I am using PnPJS in an SPFx webpart in which I have a method to set custom item level permissions on specific items in several lists. My code is as follows: let listIds: string[] = [ "LISTGUID1", "LISTGUID2" ]; for (const listId of listIds)…
Abbas
  • 14,186
  • 6
  • 41
  • 72
0
votes
1 answer

PnP JS Add Item with FieldGeolocationValue - SharePoint

I'm trying to add an item to a list that contains a Geolocation field, I cannot find how to add a value to this field in the docs, I've tried with several ways, no success: await web.lists.getByTitle('Opiniones') .items.add({ ... Location: {…
Escobar5
  • 3,941
  • 8
  • 39
  • 62
-1
votes
1 answer

Upload the dropped file inside Read DropZone to SharePoint online document library inside SPFX

I am building an SPFx web part inside our SharePoint Online tenant, where we have a react dropzone, to upload a file, which should automatically get uploaded to SharePoint document library:- Here is my Service:- // Uploads a dropped excel sheet to…
John John
  • 1
  • 72
  • 238
  • 501
-1
votes
1 answer

Get a specific list item with SPFX and PNP/JS and show it in SharePoint Online Webpart/Widget

I want to read the values of a specific list element by ID and show it on a SharePoint site. The problem is that I tried to use the PNP Framework, but some of the components are not working any longer. Here is my code so far. I hope you can help…
Matthias
  • 9
  • 1
  • 6
1 2 3
9
10