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

Get-PnPListItem -Query or Where-Object

I have 2 main questions here : I want to use a query with the cmdlet Get-PnPlistItem should I use -Query or | Where-Object to do it? What is wrong with this line? it returns me a null array when it shouldn't : $listItem = Get-PnPListItem -List…
Ricola
  • 51
  • 4
0
votes
1 answer

Updated spfx yeoman generator now I get a bunch of errors

So I ran npm install @microsoft/generator-sharepoint@latest -g Now I have a bunch of errors in my WebPart.ts files spfxContext is highlighted and the error is ... (property) ILibraryConfiguration.spfxContext?: ISPFXContext Used to supply the current…
Pete Whelan
  • 85
  • 11
0
votes
1 answer

How to add multiple fields to SharePoint Online list using @pnp/sp single API call?

I have created the SPFx web part for SharePoint Online. I have implemented functionality like If the user added the SPFx app to the SharePoint site the lists are automatically created while adding an app. For that, I have created a list then created…
0
votes
0 answers

Optimizing VERY Slow PS Script

I have a PS script that is taking CSV files (the largest being about 170MB) and splitting it into multiple smaller CSVs based on the ListGuid value. It is then taking each file and uploading it to a specific path in SharePoint using PnP based on the…
Schmit
  • 41
  • 5
  • 12
0
votes
1 answer

read document urls in a sharepoint library via pnp Js ver 3

I am using pnp.js ver 3 libary to read some images within a document library. But the following two functions do not return the url/FileRef or even the Name of the stored document. Even if i explicitly specify the url column(s) in viewXml node of…
punjabi
  • 49
  • 9
0
votes
1 answer

Unable to update Azure AD user property from SharePoint using @pnp/graph

I have created a SharePoint Framework web part using React. After that, I integrated @pnp/graph under that SPFx application. Also, I have given an API access permission request to my SPFx app. I have fetched all users from the Azure AD group. Now, I…
0
votes
1 answer

How to get more than 100 Azure AD users from specific Azure AD Security group using @pnp/graph?

I have to fetch users from Azure AD particular group using @pnp/graph. But I got only 100 users from the group. Below is my query to get a specific Azure AD group user, const members = await…
0
votes
1 answer

Newly added SharePoint List column is hidden - SPFx WebPart

I added list column as below using pnp js and api call is working without issue. but Column is hidden even it is created. is there any reason for that ? var fieldXML = "
0
votes
1 answer

How to fetch more than 5000 item from SharePoint Online list using @pnp/pnpjs library?

I am using SharePoint Online. I am using "@pnp/pnpjs" library to get data from the SharePoint Online list. I have created a SharePoint list that contains more than 5000 items. How can I get all list items using the get function from @pnp/pnpjs…
0
votes
1 answer

SharePoint Framework SPFx , no exported memeber SP, PnPJs

Below is my code: import * as React from 'react'; import styles from './PnpfolderoperationsDemo.module.scss'; import { IPnpfolderoperationsDemoProps } from './IPnpfolderoperationsDemoProps'; import { escape } from…
Pramod
  • 1
  • 1
  • 2
0
votes
1 answer

PNP PeoplePicker Type 'WebPartContext' is missing the following properties from type 'BaseComponentContext'

I am using spfx Peoplepicker control in my spfx react webpart solution but Peoplepicker control encountering the below error. Error : Type 'WebPartContext' is missing the following properties from type 'BaseComponentContext': _isServedFromLocalhost,…
0
votes
1 answer

Error on items.add in pnpjs after 30minutes

I´m using "@pnp/sp": "^3.0.3", I have this code const sp = spfi().using(SPFx(props.context)); const item = { Title: mail, URL: { Url: url.trim(), Description: name.trim() }, }; await…
Fed Liskov
  • 428
  • 4
  • 6
0
votes
2 answers

Attempting to add multiple items to SP list using sp/pnp but getting error on ```createBatch()```

I'm following this documentation: https://pnp.github.io/pnpjs/sp/items/#add-multiple-items But I'm getting an error with: import { SPFI, spfi, SPFx } from "@pnp/sp"; import "@pnp/sp/webs"; import "@pnp/sp/lists"; import "@pnp/sp/items"; import…
NightTom
  • 418
  • 15
  • 37
0
votes
1 answer

SHAREPOINT PnP Js add link to a document

I know we can add link to a document in the document library . Is there a way to do the same using pnp js ?
0
votes
1 answer

Adding into sharepoint list using react js spfx webpart

I am using this code in my webpart to insert into the sharepoint list with list name, but moving this code into production environment is creating an issue since its forming the wrong url for inserting into the list, The url in production…