Questions tagged [spfx-webparts]

Technical questions about building and using web parts based on the SharePoint Framework client-side development model.

Filter by
Sorted by
Tagged with
2
votes
2answers
4k views

Get current user's user group in SPFx WebPart

How can I get the sharepoint groups the current user is a part/ belogns to, without @pnp/sp js framework in SPFx ?
2
votes
1answer
1k views

SPFX 1.7.1 - Full page apps - How to configure

So i've been away from SPFX for a while since they were still using the older version of React and i've got a question. I can see that they added a developer preview of "Full Page apps". How can you ...
2
votes
1answer
6k views

How to dynamically bind value (Options) to Dropdown - Office UI Fabric React Components

I'm using Office UI Fabric React dropdown in my spfx webpart. I have added static options in that dropdown as below, but I want to bind options dynamically which i'm getting from REST api. <...
2
votes
1answer
2k views

How to apply a theme to a spfx web part?

I have a spfx web part the gets and displays list items. I'm not sure how to apply a theme to this web part so that the font type and style of the web part title and list items match the rest of the ...
2
votes
1answer
414 views

Restrict audience for SharePoint Framework Solutions

Is it possible to restrict the audience for SharePoint Framework solutions? By individual sites or users. Deploying solutions to the app catalog make them available tenant-wide, but some solutions ...
2
votes
1answer
2k views

How to add items to SPO list synchronously in spfx webparts?

I have twelve items that need to be added to a list on button click. I am using the sp-pnp-js library to add items. But the function adds items to the list asynchronously. I have tried many ways. ...
2
votes
1answer
216 views

Supported scenario to have web part *and* assets in one SharePoint Framework package?

Expected behavior Going by the tutorials I would expect to be able to make a package that contains some assets, like a list, as well as at least one web part - all in the same package. Observed ...
2
votes
1answer
3k views

How do we attach a hover event to a fabric DetailsList in an SPFX webpart?

How do we attach a hover event to a fabric DetailsList in an SPFX web part? I have a list of documents in a spfx web part displayed in a fabric DetailsList. When a user hovers over an item I want to ...
2
votes
3answers
3k views

SharePoint Framework and workbench.aspx

I'm trying out the SharePoint Framework and am following the setup instructions. I've downloaded and uploaded to my site workbench.aspx. When I go to "preview the web part in SharePoint" and load the ...
2
votes
2answers
125 views

how gulp serve related to sharepoint spfx webpart

I have created the sample spfx solution and uploaded it into the app catalog and i have added it to the site page. if I am changing in the local code and if I run the gulp serve the actual changes are ...
2
votes
1answer
163 views

Get list of alerts of the current user from the whole site collection

My scenario: i want to create a spfx web part that uses a rest API that will query all the alerts throughout the whole site collection for the current user. I want to know which API to use and ...
2
votes
2answers
1k views

Add files to subfolders using rest api in javascript

What is working right now is i can upload to the root folder of a library using the code below : myDropzone.options.url = `${_context.pageContext.web.absoluteUrl}/_api/web/Lists/getById('${_parent....
2
votes
1answer
2k views

How to get App Catalog site URL using JavaScript?

Is there a way to programmatically get the App Catalog site URL in a SharePoint Framework (SPFx) Web Part? I'd like to read/set the SharePoint Tenant Properties in my Web Part. However, we need to ...
2
votes
1answer
919 views

How to make SPFx web part content searchable

I'm working on a Communications site, and I can't make content created in special custom editors (like the React Script Editor, or the React TinyMCE editor included in the sample web parts) searchable....
2
votes
1answer
2k views

How will SPFx on SharePoint-Online detect the language

Regional Settings in related SharePoint-Site? -- What about alternate activated languages? -- What about preferred language setting in user profile? So, who will win when opening a page with a ...
2
votes
1answer
616 views

SPFX - Target Audiences

what do you know about target audiences in Spfx modern pages or webparts? i have been searching information about this, but I'm still in blank. Thank you !
2
votes
1answer
495 views

SPFX - PnP JS Core for SPFx On-Premise v1.0.2

I want to use PnP JS Core in SPFx v1.0.2 React webpart for SP16 On-premise server . What is the version of pnp need to use and how to install it? What are the other options for accessing data in ...
2
votes
3answers
5k views

webpack “Module not found: Error: Cannot resolve 'file' or 'directory”

I successfully followed and executed 6 of the 7 SPX tutorials. In the last one "Document Card Example", I get the following error during build: [16:20:50] Starting subtask 'configure-webpack'... [16:...
2
votes
1answer
537 views

@microsoft/sp-loader install fails with install script error

I'm trying to create SharePoint Framework hello world project as mentioned in tutorial. But it fails in the end with error npm ERR! @microsoft/sp-loader@1.0.0 install: node npm-install-script.js. ...
2
votes
1answer
2k views

Spfx Delete item from list

I delete last inserted item from list with this method below; private deleteItem(): void { if (!window.confirm('Are you sure you want to delete the latest item?')) { return; } this....
2
votes
1answer
812 views

Web part not available to add in the Workbench which is hosted on SharePoint Library

I am building my first SharePoint client-side web part (Hello World part 1). Everything works perfect no issues with the following. Successfully set up Machine with NodeJs, Gulp, Yeoman etc Got the ...
2
votes
2answers
81 views

SPFx. Error while importing modernizr in SPFx

I am new to SPFx and I am getting an error while trying to add jQuery and external JS in SPFX. Example my web-part name is FlipBookWebPart and I am trying to add turn.js and modernizr.js into the ...
2
votes
1answer
464 views

Use CKEditor in SharePoint spfx solution with React

We are trying to set up and use CKEditor5 with React in a SharePoint spfx solution (of course also React), but we are struggling with making it work as we would like. The Classic build of CKEditor5 ...
2
votes
1answer
2k views

How to Get Site-users and Site-groups in SPFx using PnP-JS?

How to get the site users and site groups in SPFx using PnP JS? Thanks in advance.
2
votes
1answer
60 views

Is there something like “View Customizer” in SPFx?

There is Tiles example on Github. But this is JSON Column Formatting. Is there a way to have more control above View rendering from SPFx web-part? I know field customizers can change behavior for ...
2
votes
1answer
1k views

tslint.json unknown compiler option 'extends'

i try to upgrade my WebPart to SharePoint spfx 1.9.1, i follow recommandation generated by o365 spfx project upgrade --output md > report.md, but when i build my project i get two errors : [16:10:...
2
votes
1answer
1k views

spfx office fabric ui CSS is not working

I just now upgraded SPFX from 1.7.1 to 1.8.2. I have referred office fabric UI css class like ms-grid, ms-GridRow, ms-u-md6 etc... before upgrading everything is working fine. But know office fabric ...
2
votes
1answer
212 views

MS Graph API - Problems on SPO Mobile-App

The Background: I am developing Sharepoint Online Webparts on-demand. Sometimes the functionality of these Webparts include the use of Microsoft's "Graph-API" to access Data regarding Office 365 ...
2
votes
1answer
221 views

Rest API to update a library item giving 400 error

The code am using: pnp.sp.web.getFolderByServerRelativeUrl("Shared%20Documents").files.getByName("test.jpg").getItem().then(item => { item.update({ Title: "A Title", ...
2
votes
1answer
742 views

Can I use a SPFX ListView Command Extension to copy files from another library?

I'm looking at using the ListView Command SharePoint Framework Extension on a SharePoint document library. Essentially all it will do is have one command called "New Project". On selecting the ...
2
votes
1answer
785 views

How to change state in webpart.tsx from wepart.ts property pane - SPFx

I am trying to add a button to my property pane that will pop up a modal where the user will be able to enter in an image to be displayed on my banner webpart which is just an image carousel. I ...
2
votes
1answer
1k views

Modify/Access webpart properties in SharePoint Framework (Spfx)

I am trying to saving some value in the Web part properties. I know in Spfx you can save or update any value in webpart property like this.properties.myProp = "newValue"; I am using angular ...
2
votes
2answers
2k views

PageContextInfo: Page Context is undefined in sharepoint framework (Webpart)

I am trying to upgrade an old sharepoint project to the latest sharepoint framework. The client part is built with angular. As in spfx _spPageContextInfo is not available so I tired changing the code ...
2
votes
1answer
141 views

SharePoint Online: Guidance on using “classic” UI libraries in “modern” experience

Are classic APIs like SP.UI.Notify.addNotification supposed to be used in the modern experience of SharePoint Online or are they deprecated? Is there documentation about this anywhere? ...
2
votes
1answer
544 views

SPFX - SP.UI.Notifications.addNotifcation not available?

I've created a webpart using SPFX GA. In the externals section of the config.json I've added the following from the layouts folder. init.js microsoftajax.js sp.runtime.js sp.js sp.ui.dialog.js ...
2
votes
1answer
192 views

Webpack Error when running “gulp serve” for basic Hello World webpart

I am getting the following error when running "gulp serve" command after scaffolding the basic Hello World web-part project. I have installed the latest versions of Node LTS v6.9.5 and TypeScript 2.1....
2
votes
2answers
827 views

Does SPFx have special access to REST endpoints?

In the latest SPFx video https://www.youtube.com/watch?v=6r6MqUDzKvI The SPFX Wizard explains how to add an escape function Quoting the SPFx Wizard: "Escape the value for any characters that ...
2
votes
1answer
922 views

How can I 'bundle' a json file into a SharePoint Framework webpart?

I have a large block of JSON I need to be available in my webpart, a 'canned' search result used when in the workbench and not connected to SharePoint. Ideally I would like to reference it as follows:...
2
votes
2answers
669 views

Retrieving data from rich text editor in spfx web part properties

I am currently creating a custom web part, the webpart is using PropertyFieldCollectionData to collect user data (https://sharepoint.github.io/sp-dev-fx-property-controls/controls/...
2
votes
3answers
581 views

Get information of employee from Employee ID in Sharepoint Framework(SPFX) using REST API

I am using Sharepoint Framework(SPFX) and using Typescript for calling REST APIs. I want to get information of other employees from Office 365 or Active Directory using their Email ID or Employee ID. ...
2
votes
1answer
112 views

SPFX: How to create an <img> tag containing the photo BLOB returned by MSGraph photo/$value

I'm creating somekind of custom Who-is-Who web part. After retrieving the Users information with MSGraphClient /users API I'm trying to retrieve and display the Photo for each employee. I'm having a ...
2
votes
1answer
510 views

SPFX and React : Component not rendering correctly because of findDOMNode returns null

I am a new React learner, and I may have a situation with render() and findDOMNode. What I have and what is the wrong behavior : I'm quite new to React so, I may have done lots of mistakes there. I ...
2
votes
2answers
10k views

Failed to execute 'json' on 'Response': body stream is locked

I am following this article and get the following error in the console.log Uncaught (in promise) TypeError: Failed to execute 'json' on 'Response': body stream is locked at e.json (sp-pages-...
2
votes
1answer
1k views

Add Dynamic Property Panes to SPFX

I know this has been asked 1000 times, but i've tried everything in the first 2 pages of google so i've decided to come to you guys for help. I'm trying to create some dynamically added property ...
2
votes
1answer
276 views

Problems Unit Testing in SharePoint Framework (SPFx) with External Dependencies

I'm attempting to use Elio and Velin's guidance on creating unit tests for the SharePoint framework. Both appear to work great for vanilla components, but I'm running into problems when trying to ...
2
votes
1answer
71 views

Best Practice for Stylesheet If statements in SPFx

I'm starting to work with SPFx and have the following code: public render(): void { SPComponentLoader.loadCss('https://use.fontawesome.com/releases/v5.0.6/css/all.css'); var abc = (this.properties....
2
votes
2answers
1k views

Add external libraries in SPFx?

How to add external libraries like material-ui to our Spfx Webpart? I know to add external libraries having their CDN link and types definition like jquery but don't know how to add libraries which ...
2
votes
1answer
470 views

How to add SPFx client side webpart to MasterPage

I have a webpart that is developed using SharePoint Framework. This wepart should appear across the pages in the site collection. I know that we can add server side webparts in master page. How can we ...
2
votes
1answer
423 views

How to provisioning a SPFx web part using CSOM OnPrem (SP2016)

I have developed a SPFx web part. How do I provision the webpart part using CSOM to an OnPrem SharePoint 2016 server?
2
votes
1answer
2k views

SPFx - How to get current list Title in WebPart

I add my sharepoint framework webpart in AddForm.aspx page in my list. I want to get current list title. How to do this? When i use _spPageContextInfo i have following properties for list:

1
3 4
5
6 7
20