Questions tagged [pnpjs]
The pnpjs tag has no usage guidance.
138
questions
0
votes
1
answer
15
views
Update a folder custom property after a searchresult
In my SharePoint site, I have my document library "MyDocs", and I have a list of companies "Companies"
I added a new lookup column to the document Library "Company" to ...
0
votes
0
answers
20
views
Connect pnp ListView to Sharepoint File and Media WebPart
I got a spfx webpart has a ListView of Files i get with a search in Sharepoint.
Now i want that when i select a item in this listview it will Do the Preview of the file in a file and media component ...
0
votes
2
answers
41
views
SharePoint online Image item URL does not get url in target Release for Everyone
I have tried to get image URL using rest Api and PnP js in my SPFx react solution but not get proper image URL from Api response.
Below is the code and response from the Api. Missing serverRelativeUrl ...
0
votes
0
answers
12
views
Entering data into an excel sheet with PnPjs
I want to create a webpart for a sharepoint site, that allows users to enter an identifier about the sheet then using PnPjs i want to allow users to enter that data into the sheet. I would have ...
0
votes
0
answers
21
views
Waiting for folders to be created to avoid 'Not found' errors using PnPJS
I am using PnPJS to create folders in SharePoint within a SPFX WebPart. I'm having random issues when creating a bunch of folders when some of them return an error of 'Not Found'. For example:
...
0
votes
1
answer
45
views
Pnpjs, How to surpress "Object is possibly 'undefined'" ts error on SharePoint context functions
For example I SP function, for example to format a date:
const friendlyDate = new Date().format("dd.MM.yyyy");
console.log(friendlyDate);
You can run in in Dev Tools on SharePoint page:
...
0
votes
1
answer
38
views
spfx pnpjs people picker error
I am getting an error when running my spfx webpart with a picker picker control. When I do gulp server I get the error
ERROR:
Cannot find module 'ControlStrings'
I have googled this and have added ...
0
votes
0
answers
72
views
Need a create list item example using spfx pnp
Having not touched spfx for sometime, I’m trying to find an example of creating a list item with a people picker a date picker and textfields but have not been able to find a working example. Can ...
0
votes
1
answer
204
views
How to set a dropdown field in SPFx React.js to the placeholder value again after creating an item in an SP Online List?
I have a form with some values. Some of the fields in the form are dropdown fields. They get the dropdown values from SharePoint PNP/JS Rest Api call.
Then the values from the form are used to create ...
0
votes
1
answer
69
views
filter a value from a list via PNP/JS and then store it in a locale variable within SPFx SharePoint Online
I have a lack of understanding of retrieving a value from a list. I want to use it to build a counter and then increment the counter locally after a button is pressed. After the incrementation I want ...
1
vote
1
answer
197
views
How can I get the profile photo of a user type field of a SharePoint list?
I am developing a Webpart with react and to get data from my Sharepoint I am using PnP js
Objective: Get the profile photo of a user-type field of a Sharepoint list
Problem description: I have a list ...
0
votes
0
answers
14
views
What is listener and subcriber in pnpjs/logging?
I'm a newbie to SPFx, I have a task to create a custom logger that can record any exception and error that happen in a web part (like serilog on .NET). I'm following a guide but there is something ...
1
vote
0
answers
76
views
Trouble using PnPJS for SharePoint Term Store in SPFx
I'm developing a SharePoint Framework (SPFx) application and am trying to interact with the SharePoint Term Store using the Patterns and Practices JavaScript Core Library (PnPJS). I'm using a version ...
0
votes
0
answers
26
views
How to enable likes on a list with pnpjs or rest api?
I need to create a list programmatically from SPFX app.
Creating the list is no problem, with pnpjs like so:
sp.web.lists.add("Ideas","Ideas", 100, true);
works great,
but I need ...
0
votes
2
answers
82
views
Pnpjs how to set homepage of site?
Is there a way with pnpjs to set the homepage of a site?
basically what Set-PnPHomePage commandlet does
I can create a site, web, client side page, add controls to that page with pnpjs, but I cant see ...
0
votes
2
answers
467
views
Search in PnP Modern Search/site search not working unless explicity RefinableStrin100:myquery
I have a document library with two content types. One for the folders (document set) and one (document) for the documents itself.
The document CT inherits from the other CT two columns and is these ...
0
votes
1
answer
159
views
CAML Sharepoint list to return email of Person Field
Goal: I have a Person column on a SharePoint list called Manager and I'd like to return the Manager Email for each list item as well as the value of a managed metadata field. I'm using the PnP JS ...
1
vote
1
answer
191
views
PnP JS Person field only returns FieldId and FieldStringId
I have a list with a few columns that are Person columns. Below is a snippet without a select nor expand:
const newHires = this._sp.web.lists.getById(`${listId}`).items<ListItem[]>();
const ...
0
votes
0
answers
111
views
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 ...
1
vote
1
answer
172
views
How to create a service scope using a sharepoint url passed in from an spfx property pane value
I'm using the service template found in the PnP JS documentation:
export class SampleService {
public static readonly serviceKey: ServiceKey<ISampleService> = ServiceKey.create<...
0
votes
0
answers
162
views
Unable to set the Default Values for our folder using PnP Core SDK
I have a managed metadata field named Customer as follow:-
and using PnP Core SDK inside Azure Function >> i am trying to set a default value for it inside the folder:-
here is the code, where ...
0
votes
2
answers
351
views
Unable to get PNPJS SPFX context from a ListView Extension
I am trying to create a list view extension, however I am unable to get the PNPJS context in order to query other lists.
If I go to the URL that returns a 403 in a browser tab, it works.
//default ...
0
votes
1
answer
40
views
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 ...
0
votes
1
answer
1k
views
Property 'get' does not exist on type 'IFields'
In SPFx Webpart properties, as a cascading drop down showing all list/library from the current site, based on the selection of the list, trying to show the list fields.
var spListColumns = _sp.web....
0
votes
1
answer
233
views
PnP Js - reading headers from request
I'm using PnPJs v3 for getting a data with REST API from SharePoint Online. Because there are many request, I'd like to implement a logic to avoid throttling.
I can't figure out how to read (any) ...
0
votes
1
answer
4k
views
Unable to resole Module '"@pnp/sp"' has no exported member 'spfi'
I have an SPFX solution where I tried installing 'npm install @pnp/sp --save'
Now, while using 'import { spfi } from "@pnp/sp"' I am getting below error.
'"@pnp/sp"' has no ...
3
votes
1
answer
930
views
Unable to resolve "@pnp/graph"' has no exported member named 'graph' in SPFX solution
I have an SPFX solution where I am trying to use Graph API.
I tried installing 'npm install @pnp/logging @pnp/core @pnp/queryable @pnp/graph --save'
Now, while using 'import { graph } from "@pnp/...
1
vote
2
answers
123
views
How to build start token for list getchanges?
Using PnP JS for brevity. I am having major difficulty figuring out what date time format the following requires.
Use case: I have date time for my last cache, I want to get the differences in my ...
0
votes
1
answer
336
views
pnp-js Unable to update file in subsite 403 error
I am trying to update a file in document library from webpart, code is working fine for site collection but not working for subsite, getting below error message
Error: Error making HttpClient request ...
0
votes
0
answers
166
views
PNP/SP not working in team context
I have created the SPFX tab webpart with crud Operation in sharepoint list
Not working in Microsoft teams app
but this webpart working in sharepoint page because its getting SharePoint context
I am ...
1
vote
1
answer
731
views
ListViewCommandSetContext is not assignable to parameter of type ISPFXContext
I followed this tutorial : building-simple-cmdset-with-dialog-api
And I installed the latest @pnp/sp (3.4.1) and according to the docs I should be able to use it as follows:
const sp = spfi().using(...
0
votes
1
answer
478
views
PNP js version 3 get sp object return a Proxy object
I create a SPFX with PNP JS version 3, when I try to get the sp object , it return a Proxy object. I try to use the getSP() function in the official demo , same result.
getItems() {
//
const ...
0
votes
1
answer
557
views
Get users who have permissions on a particular list item
Is it possible to check the list of users who have read access on a particular item using PnP JS?
I tried something like this but roleAssignments is not available on item it seems.
const response = ...
2
votes
2
answers
2k
views
Facing Error Implementing CRUD operations using spfi pnpjs package
I was trying to implement CRUD Operations using spfi. So, I was following this PnpJS Blog to find solution to my problem: https://pnp.github.io/pnpjs/sp/items/
So, they have imported spfi and assigned ...
0
votes
0
answers
2k
views
Undefined (reading 'web') error when using pnp/sp
I am trying to write a web part that gives the user a list of document libraries for the current site they are in, allows them to choose from this list, and then click a button which then gets all of ...
1
vote
1
answer
257
views
Error while following Microsoft documentation on web part caching with PnPJS
Microsoft official documentation-
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/use-sp-pnp-js-with-spfx-web-parts
In the PnPjsExample.tsx part, this part of code has:
const ...
1
vote
2
answers
859
views
Attempting to delete multiple items from SP list using pnpjs V3 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 sp.web.createBatch():
import { SPFI, spfi, SPFx } from "@pnp/sp";
...
1
vote
1
answer
179
views
PnPJs Modern site webpart without SPFx - 404 error
Want to use PnPJs on a content editor webpart added to a modern page. All attempts to use pnp results in a 404. What is seen is that pnp is inserting /SitePages into the API call.
https://{server}/...
0
votes
1
answer
615
views
What is the latest version of "sp-pnp-js" that is compatible with SPFx v1.4.1 (On-Premise)
Does anyone know which is the latest version of sp-pnp-js that is compatible with SharePoint Framework v1.4.1 for SharePoint 2019 On-Premise?
Тhanks in advance
0
votes
1
answer
279
views
how to dynamically populate image in propertyPane dropdownOptions?
check this image i want to get the same in DropdownOptions like this
https://i.stack.imgur.com/ihfJn.png
i'm getting key and title on the property pane perfectly i just need to display images from ...
0
votes
1
answer
787
views
RenderListDataAsStream Rest API not returning Field in ViewFields
RenderListDataAsStream is not returning some fields specified in ViewFields.
I need to retrieve ServerRedirectedEmbedUrl but doesn't return anything.
If I run the following CAML Query specifying the ...
1
vote
1
answer
589
views
Remove user from site group using PnP-SP in JavaScript
I'm trying to find a way to remove a user from a group using PnP-SP. My code is as follows:
this.$pnp.sp.web.siteGroups.getById(this.selectedGroup.Id).users
.remove(user)
....
0
votes
1
answer
7k
views
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'substring')
I am using PnP JS in SPFx to get page content. I wanted to get content type id of the page and check if it belongs to certain content type.
I can't seem to make contain or includes function work so I ...
0
votes
3
answers
819
views
How to get the file length using PnP JS?
I know how to get the file size using REST API, basically this here:
https://tenant.sharepoint.com/sites/site_name/_api/web/GetFileByServerRelativePath(decodedurl='/sites/site_name/Lists/ListName/...
0
votes
1
answer
3k
views
Get SharePoint URL using sp-pnp-js in SPFx
I have a SharePoint SPFx react webapp that I'm working on. I'm trying to get the SharePoint URL. For example:
https://mysite.sharepoint.com/sites/sitename/SitePages/Home.aspx#/
So I want to get ...
0
votes
1
answer
55
views
Metainformation about SharePoint structures for typescript/JavaScript?
Hi all I think it is easier if I try to explain with an example.
So if I want to add a field using xml I need to populate the xml based on what data a field of an specific type can have. SharePoint ...
1
vote
0
answers
160
views
SitePicker PnP control not returning any value in my one of the tenant
PropertyFieldSitePicker Pnp control not returning any value in my one of the tenant but in another tenant, it's working fine.
Scenario: I have created one SPFx solution with PropertyFieldSitePicker ...
0
votes
1
answer
804
views
How to get Library Name using sp.web.getFileByUrl
Is there any way to get the library name in the SP.web.getFileByUrl.
I have tried the below code but not getting library name
let result = await sp.web.getFileByUrl("https://sample.sharepoint.com/...
0
votes
0
answers
321
views
Couldnt get users from sharepoint group via pnp js selective imports
I am using code from documentation, basically the following to get all users from SharePoint group through selective imports.
import { sp } from "@pnp/sp";
import "@pnp/sp/webs";
...
1
vote
1
answer
1k
views
SharePoint how to ensure user in spfx
I have a question regarding SharePoint development. I'm working on a SPFX webpart for SP2019, the webpart is going to retrieve data from external source and the data will contain AD users. In my ...