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

Using pnpjs 8.15 in SPFx - get() is not a function

New to pnpjs, using 8.15.0 trying to get a list of lists in a SPFx. I'm getting error: TypeError: this.sp.web.lists.get is not a function. I have list item updates working in this same ts file. Assuming I am missing an import, can anyone…
Joe Johnston
  • 2,794
  • 2
  • 31
  • 54
0
votes
1 answer

PNP JS - Site members and owners

I'm trying to find the owners and members for a given site. Once we have the site we get the given groups for each of the following: associatedMemberGroup associatedOwnerGroup The code we use is below: const memberGroup = await…
0
votes
1 answer

How can I fix a 'context is null' error when retrieving an item and column from a SharePoint list with React and pnpjs?

Retrieve one item and on column from this item to SharePoint list using React pnpjs. I 'm starting to build an application with spfx and reac, I try to use pnpjs for retrieve one item and on column from this item to SharePoint list using React…
0
votes
1 answer

How to get SharePoint online site usage report using sp/pnp?

I have created SharePoint Framework Solution for custom development in the SharePoint Online. I need to display SharePoint site usage report in my SPFx web part. I have tried with @pnp/graph and @pnp/sp but I can not find any solution. Can anyone…
thedeepponkiya
  • 97
  • 1
  • 11
0
votes
0 answers

Sample folder explorer in a SharePoint React application

I have a react application using fluentui and pnp libraries in a SharePoint application. I would like to let users select a folder from the site content. I started a sample in StackBlitz with the following (gpt) suggestion import React, { useState,…
serge
  • 13,940
  • 35
  • 121
  • 205
0
votes
1 answer

Accessing Word Automation Services using pnpjs

We are investigating using SharePoint, SP, Word Automation Services, WAS, on demand to render Table of Contents, ToCs in word documents we are generating, prior to sending them to a third party vendor. Avoiding the need to open the Word Document to…
0
votes
1 answer

Get data from another sharepoint list while we store id in my current list?

I have a category list in SharePoint which have all categories in my list: While it is sub-category list which has all sub-categories And I also have third list which have items and the respective category and sub-category IDs: I have to develop…
0
votes
0 answers

Multi Select Field of type Person or Group as filter in custom vertical is not parsed as single values in OOTB Microsoft Search

I've created a custom search vertical under Microsoft Search settings in a modern SharePoint Online site collection. There are couple of fields which are multi select Managed Metadata and Person or Group fields. The data is stored in them in the…
0
votes
0 answers

SharePoint Modern Search Experience Customization

I need to customize the modern search experience in SharePoint Online. I need to add excel type filters under the search result page. I need to change the look and feel of the search result page. I need to configure the search as we can configure…
Bhoomesh Joshi
  • 89
  • 1
  • 1
  • 5
0
votes
0 answers

Call open ai api in React JS class component for continue stream the data

callOpenAI3(): void { if (this.state.isDone) { return; // Stop fetching data if we're done } const CancelToken = axios.CancelToken; const source = CancelToken.source(); this.source = source; const API_KEY = 'xyz'; const ENGINE =…
uday
  • 1
  • 2
0
votes
1 answer

How to retrieve data from list in SPFX solution

I have 3 components - RequestSHP.tsx, WebPart.ts, Exekucie.tsx I am trying to get data to dropdown from list, but getting error "404 (Not Found)" Here is my RequestSHP.tsx -> import {sp} from '@pnp/sp/presets/all'; export default class RequestSHP…
jck4real
  • 33
  • 7
0
votes
0 answers

Create new page in child folder under Site Pages library using @pnp/sp

I need to create a page programmatically in a child folder under the Site Page library. I have created an SPFx solution for the same. I have created a functional component and added one button on that button click event I need to create a page under…
0
votes
0 answers

Sharepoint framework SPFX global configuration for using @pnp/sp

I am creating a webpart using SPFX(react). I am using @pnp/sp for interaction with sharepoint. I want to have a global pnp configuration with the context without having to pass the context in each component as props. I followed this code and created…
Imjaad
  • 588
  • 3
  • 12
0
votes
0 answers

Attempted to perform an unauthorized operation while copyByPath using @pnp/sp

I have created functionality for folder creation under the SharePoint document library nested folder and copied files from another folder to a recently created folder. I have used the "@pnp/sp":"2.11.0" library for performing the folder creation and…
0
votes
0 answers

get Termgroup From Metadata Field

I'm making a spfx webpart that use Terms customProperties from metadata Column. I'm able to retrieve the TermId from list and the TermSet (from the List Field Properties) But I'm not able to retrieve the TermGroup. How Can I get it or Search…
Eldrad95
  • 35
  • 5
1 2
3
9 10