Questions tagged [spfx-webparts]
Technical questions about building and using web parts based on the SharePoint Framework client-side development model.
1,205
questions
0
votes
0
answers
3
views
SPFx Retrieve lists using SharePoint REST API
I am trying to create a web part to deploy to SharePoint Online. Following this Connect your web part to SharePoint.
When I add the code below. I receive the errors below.
Do you have to have Office ...
0
votes
0
answers
4
views
Fetch the targeted content from a SharePoint list using Rest API
I have a SharePoint list on which Target Audience is enabled.
There is custom list SPFx webpart which shows the list items using the Rest API.
I want to display the content based on the targeted ...
0
votes
1
answer
24
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
22
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
1
answer
21
views
Using .env files with SPFx components - Undefined issues
I'm having a nightmare with using environment variables in my SPFx project. I have:
a .env in the root of my project
variables within this file all starting with REACT_APP_
references to these ...
1
vote
1
answer
18
views
PropertyFieldCollectionData control Panel customization
Is it possible to edit No data in your collection text in the panel? See the image below.
I need to change the text depends on the user language.
I am able to change the text in Save and cancel ...
0
votes
1
answer
20
views
how to get data from responseJSON
I am trying below code but always get undefined in console for console.log(responseJSON.Title);
this.props.context.spHttpClient.get(`https://someazuresite.azurewebsites.net/api`,
SPHttpClient....
0
votes
1
answer
33
views
Is there any problem if my SPFx requires "node": ">=16.13.0 <17.0.0" while my node.js version is "14.18.1"
I want to deploy this SPFx sample inside my tenant @ https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-chatgpt-app. Now inside the package.json file below is mentioned regarding the ...
0
votes
1
answer
32
views
How can I get data from azure web API in SPFx web part?
How can I load data from azure web API into SPFx web part?
API:
https://someazuresite.azurewebsites.net/api
Code I am using currently:
this.props.context.spHttpClient.get(`https://someazuresite....
0
votes
1
answer
26
views
Send query to result page from custom search box
How shall I send my query from search box to result page if below is my code in react js:
this._handleSearch.bind(this)
<SearchBox
styles={searchBoxStyles}
placeholder="...
0
votes
1
answer
67
views
It is fine if we store the Chat GPT api key inside the SPFx web part properties
I want to embed a chat GPT inside our SharePoint and i found this web part @ https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-chat-gpt .but the issue is that it stores the Chat GPT ...
0
votes
0
answers
62
views
Tracking down an error from SPFX web part that started yesterday
I have a Spfx web part used on a page in Sharepoint Online that's been in use for over a year. It hasn't changed in at least two months. It uses chart.js to display some data from an api call.
...
0
votes
2
answers
39
views
How to build a CAML query from a string of data in JavaScript?
I have a string 'listOfUsers' which is in the format user1;user2;user3;user4;user5;user6;
This string could have any number of users.
I would like to build a CAML query which will find all those users....
0
votes
1
answer
31
views
SPFx to add watermark to PDF before downloading it
We need to develop SPFx web part, which show pdfs from our document library inside SharePoint online site collection. and we need the SPFx to add bookmarks to the pdf on runtime before downloading it, ...
2
votes
0
answers
23
views
HTML in Long Description of SPFx Package-Solution
According to the schema for a SPFx package-solution, the longDescription, which is located under metadadata should accept HTML. I have been able to put newline characters (using \n) but not HTML.
...
2
votes
1
answer
34
views
SPFx SCSS - how do I reference third party classes along with my class to increase the specificity of my selector?
** For simplicity's sake I am not going to include all the Typescript stuff in my code examples here, so please just roll with it.
I'm using Semantic UI React as a UI component/styling framework for ...
2
votes
1
answer
56
views
SPFX Property Pane property Undefined
I have added a PropertyPaneSlider control to an spfx web part. The control displays on the page and appears to be configured correctly.
I want to get the value of the control from the properties ...
0
votes
2
answers
68
views
Web-Part works on localhost, but it does not working on SPO
I have a webpart, which works on my localhost fine, i can read items from List "A", and can write items in List "B".
I deploy it on my site collection, so I add the sppkg file in ...
1
vote
1
answer
126
views
SPFx web part to modify left navigation
Is it possible to build a SPFx web part which can replace the left navigation? I would like to create my own navigation that will use a treeview control.
When I edit my sharepoint site I can insert a ...
0
votes
2
answers
43
views
DefaultButton onClick action aborted without any error message
I'm working on a SharePoint Webpart and my DefaultButton has brocken.
I load items to an office-ui-fabric Dropdown from a SharePoint List. It's working fine, I get the value of the selected options, ...
0
votes
0
answers
29
views
SPFx: pnp.np.search how to get results by the PATH that have a specific value
I making a simple SPFx. I would like to sort results by the path that only contain "/Lists/" in url.
pnp.sp.search({
RowLimit: 20,
StartRow: 0,
...
0
votes
1
answer
136
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
2
answers
152
views
SPFx: pnp.sp.search how to get only list items
I made search in SPFx, now i need to display only list items. My code example:
pnp.sp.search({
Querytext: query,
RowLimit: 20,
StartRow: 0,
QueryTemplate: "...
0
votes
1
answer
46
views
SPFx: pnp.sp.search what is Refiners and how them to use?
I making simple SPFx search. I need to use Refiners to get data from SharePoint. Which Refiners is available to use? Can you please give me example with Refiners?
pnp.sp.search({ Querytext: queryText, ...
1
vote
1
answer
42
views
SPFx: which QueryTemplate can I use in pnp.sp.search?
I wonder which QueryTemplate available to use with pnp.sp.search?
For right now I find only one property :"(IsDocument:True)"
pnp.sp.search({
Querytext: query,
...
0
votes
1
answer
38
views
SPFx: pnp.sp.search result how to search by date
I'm using pnp.sp.serach to search files and folders.
I need to search by file's and folder's date.
I see results have properties LastModifiedTime, but the value came undefined.
pnp.sp.search({
...
0
votes
1
answer
60
views
SPFx: sort pnp.sp.search how to make query search results by start and end date
I am making simple SPFx search for SharePoint folders and files. How can I make search query that search results between start and end dates using QueryTemplate or Refiners properties?
return new ...
1
vote
1
answer
69
views
SPFx PNP people picker error for allowUnvalidated
I am using PNP SPFx React PeoplePicker in my SPFx webpart. But when I add allowUnvalidated property to my PeoplePicker. I get this error:
Property 'allowUnvalidated' does not exist on type '...
4
votes
2
answers
67
views
Is SharePoint Framework Web Part Running in the SharePoint App?
Is there a way to determine in code if an SPFx web part is running in the SharePoint App rather than in SharePoint in the browser?
0
votes
1
answer
131
views
SPFX: make a search by current website with pnp/sp
I need to create SPFx with search that scope of search will be full website and it will be searching by using pnp/sp.
I find code that only searched by list name, but I need search by full website.
...
0
votes
1
answer
27
views
Unable to get preview of a msg file from SharePoint REST API
How can I get preview URL of a msg file? I’m developing a custom search web part in SPFx framework.
My code:
Const sp = spfi(“https://home.sharepoint.com/sites/site/").using(SPFx(this.props....
1
vote
1
answer
154
views
gulp serve error
I'm trying to work on a project of a SPFx web part. The project was built normally but when I try to test my web part on my tenant the following error occurs:
Error: Your dev environment is running ...
0
votes
0
answers
8
views
When we do save as draft we are getting old field value for the property pane field , why its happening and how to get latest value on save as draft?
We are having GUID in the webpart property pane, But when we edit that in sharepoint page its giving correct value but on save as draft , again the previous value is getting populated for the guid, ...
1
vote
1
answer
170
views
How do I pass HTML table inside mailto in anchor tag?
I am creating a web part in SharePoint Online using SPFx REACT framework and I want to open an email pop up with an HTML table in the body section of the email.
Currently, I am using mailto to open an ...
0
votes
1
answer
45
views
Can we execute a python script within SPFX webpart
I have a python script which uses some python libraries to do decrypting and encryption . Is there a way where I can invoke this script inside the webpart code.
0
votes
0
answers
98
views
How can we add a SPFx webpart to an application page in SharePoint 2019?
We are trying to add a SPFx webpart to an application page but are encountering some issues. The steps we have taken are the following:
We create a new web part page in SharePoint designer and add ...
4
votes
1
answer
185
views
How do I upgrade an SPFx web part to the newest SPFx version?
I found a web part to show and print PDF docs from SharePoint, and it seems to support the swipe gesture too. The code is for SPFx v1.12. I'm thinking about upgrading to v1.16 first.
What would I need ...
0
votes
0
answers
23
views
Display custom avatar instead of OOTB in SharePoint Online programatically
I am showing user profile pictures in my SharePoint portal for all logged in users. For the users who uploaded their pictures its showing fine, but for the users who do not uploaded their pictures its ...
0
votes
0
answers
82
views
SPFX Webpart on classic page: Uncaught Error: Mismatched anonymous define() module
I am experiencing an error with a custom React SPFx Webpart on a classic site. Sometimes on page refresh, a large error message stating that there is a mismatched anonymous define() module. Whenever ...
0
votes
0
answers
85
views
Error while using the Slider from React-Slick in SPFX webpart
I am trying to use react slick Slider in my SPFx web part as below.
import React from "react";
import Slider from "react-slick";
export default function SimpleSlider() {
var ...
0
votes
2
answers
33
views
How to get current page URL in SharePoint page through web part?
I tried using the window.location.href, its not working when the webpart is deployed in the production environment
How to get the current page URL on the SharePoint web part?
0
votes
1
answer
870
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
294
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
1
answer
41
views
Alternate data result SPFX
Hi all I'm trying to build an spfx webpart for project server 2019 (on prem)... Everything it was working good, I used this css but now I faced an interesting question, css have two elements container ...
0
votes
1
answer
310
views
OAuth authentication for SPFx solutions
I am challenged by a SPFx based solution (WebPart as well as Commandbar-Extension). I have a set of APIs which are secured by OAuth. There is a dedicated authentication server, so I can't just use ...
0
votes
1
answer
20
views
Getting [object object] in spfx search box value
I am working on spfx webpart which will send search value to url and append to show the results in enterprise search below is my code but every time i enter search value it always return [object ...
0
votes
0
answers
72
views
SharePoint Modern Full Width Section - Rotating Banner
I've been looking for something that I thought might be a common question. I currently leverage the SharePoint Modern Image full screen web part on my Comms Site homepage but was hoping to work in a ...
0
votes
1
answer
171
views
Cannot find module '@microsoft/sp-application-base' or its corresponding type declarations
I am working on spfx webpart and getting below error when trying to run my solution
Cannot find module '@microsoft/sp-application-base' or its corresponding type declarations
then i tried installing ...
0
votes
1
answer
191
views
The command gulp serve don't work
when i get up my local server with the command(gulp serve), instead the show in the browser my first web part it create a files.
1
vote
1
answer
137
views
Can we build a web part similar to the Quick Links web part which check if the user have permission on the related links (internal and external links)
I am working on a project to build a portal inside SharePoint online. Now i got this requirement:-
To build a quick links web part (similar to the built-in modern Quick Links)
But this quick links ...