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
0 answers

Using Custom Authentication Provider in PnP Core with tokens from front end

I'm currently working on a project where we're using PnP Core on the backend to interact with SharePoint Online. However, we need to use a custom OAuth flow on the front end to authenticate users and retrieve tokens for use with PnP Core.…
0
votes
1 answer

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'web') when using sp pnp v3

I am developing a webpart for my sharepoint tenant. When I test my solution on my workbench everything works well. But when I put it on my sharepoint online I get the error described in the description. Here is my package : "packages": { "":…
0
votes
0 answers

Different technologies to interact with SharePoint and External systems inside our SPFx web part

I am developing 2 SPFx web parts. one which shows items from a SharePoint list and the other shows items assigned for the login user from SLACK. now for the technologies, to connect to the SharePoint list and to the external systems i have…
John John
  • 1
  • 72
  • 238
  • 501
0
votes
0 answers

Provisioning of SharePoint Site and Lists from the MS Teams Personal App

I would like to provision a SharePoint Site and Lists from the Microsoft Teams Personal App. I know that can be done if used as channel app. But my requirement is to provision site/subsite from the Teams Personal app only. I am ready to use Flow or…
0
votes
0 answers

SPFx - list username shows in console but not when mapping out object array

I have made a simple SPFx application that is supposed to fetch data from a list in SharePoint Online called "Users". I am using PnP sp to get the list items and the data shows in chromeDevTools-network section as a code 200 that also shows the…
0
votes
1 answer

While we are create list and list columns using "pnp/sp". Why some of the columns are not created in one go?

While we are create list and list columns using pnp/sp. Why some of the columns are not created in one go? We need to run again then it will created. Please help me to resolve this issue. I have used SPFx solution with react and "pnp/sp". Please…
0
votes
1 answer

Issue using PropertyFieldPeoplePicker target audience control in no JS framework SPFx

I follow the instruction https://pnp.github.io/sp-dev-fx-property-controls/controls/PropertyFieldPeoplePicker/ and setup target audience in React without any issue but it is not working for No JS JS Framework web part. I am getting Failed to load…
Yon
  • 3
  • 3
0
votes
0 answers

how do i get the folders, with related subfolders and files of a document library in spfx?

At the moment I can recover all items without distinction but I would need to recall in this order: folders or files of a document library and then the relative subfolders and files of the main folder. I would need to recall in this order: folders…
0
votes
1 answer

Pnp.js Access to sub site

I use PnPJS within an REST API route like this: pnp.sp.web.lists.getByTitle("t").reserveListItemId().then(v => { pnp.sp.web.lists.getByTitle("t").items.add({ ID: v, Title: v.toString(), }).then(function (Data) { // codes …
0
votes
0 answers

searching an External user in People picker and starting an invitation

I would like to know, how can I search for non-existing external users and sending them an email like the picture bellow Below is the code that I have used:
YASi
  • 3
  • 2
0
votes
0 answers

How to find out that the user's login time has expired in sharepoint with pnp js?

I know when error 403 in a request that's mean user does not have access. But if the login time expires , again request give error 403. can you help me? I looked in other sites but I did not find the answer.
0
votes
0 answers

Refine pnp js Search function

I'm trying to get search results from the site where query string matches "Description" which is a custom column in one of the multiple document libraries in the site. Is there a way to achieve this? I have used Select Properties but that doesn't…
0
votes
0 answers

Choose multiple values from dropdown

I'm thinking about how to change the code so that I can choose multiple values from dropdown. I think my problem is in const handleChange = () => {} (if I delete handleChange, then I am able to select multiple values but on save method is…
jck4real
  • 33
  • 7
0
votes
1 answer

PnP JS handle error if case "overwrite: false" enters

My Code: try{ if (file.size <= 1048) { result = await sp.web.lists .getByTitle(documentLibraryTitle) .rootFolder.files.addUsingPath(fileNamePath, file, { Overwrite: false }); } else{ throw new Error(`The filename…
0
votes
1 answer

pnpjs get sharepoint items by view issue

I'm trying to get items from large lists using pnpjs/sp I created a promise like this: try { // const sp = spfi(); const sp = spfi().using(DefaultInit(), DefaultHeaders(), BrowserFetchWithRetry(), DefaultParse()); const list =…
Eldrad95
  • 35
  • 5