18
votes
Accepted
How to retrieve pageContext in SPFx?
this.context.pageContext is available on render() method within top level class that extends BaseClientSideWebPart.
Simply pass this.context as a props of to HelloWorld.tsx to reuse it.
Sample (...
13
votes
Accepted
PowerApps and Flow vs SharePoint Framework
Very interesting question.. let us first understand the background of what is all 3 about.
MSFlow - To Automate a business process we generally use workflows. Ms flow are alternative to workflows. ...
10
votes
How does one pass parameters to SharePoint Framework Extensions in practice?
Using Properties in Your Extension
The this.properties property of your extension are defined by the Interface you setup. By default, the interface gets defined in your main extension class file.
...
10
votes
Accepted
Hide/Disable property pane component based on another component's value
You can make use of a standard boolean check to determine whether your toggle component has value. Based on that, you can show/hide your slider component. You can do this bool check in the ...
9
votes
Accepted
SPFx calls blocked by CORS policy
The difference between jquery call and the native httclient call is a method of making http asynchronous request.
jquery uses old good xhr, but httpclient uses modern fetch api. When making CORS ...
8
votes
How to use SharePoint FrameWork for SharePoint 2016 on premise
To be able to use SPFX for SharePoint Server 2016, you must first patch you SharePoint Server 2016 with Feature Pack 2 (September 2017 Public Update for SharePoint 2016).
Once it installed, you will ...
7
votes
SPX and Typescript - how to add references to SP.JS?
The SPFx Examples are a place to learn SPFx
https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples
Alas they hardly have documentation, and some archaic code patterns cry for a code ...
7
votes
Accepted
SPFX: How to add item in SharePoint list with attachment?
Ronak,
Working with attachments can be frustrating, but I have found that using the awesome PnP library makes it easy. Here's a quick summary of how to do it:
Install the sp-pnp-js library by using ...
7
votes
Accepted
SPFX Gulp Serve for a wepart is not opening workbench
This is happening because your SPFx solution has an extension added to it.
Whenever you add SPFx extension to the solution, after running the yeoman generator, it will modify the config > serve....
6
votes
Accepted
Deploying a SPFx webpart to multiple tenants without public cdn
Currently there's no way to deploy a SPFx web part using a private CDN. Private CDN's URL is not static - which is a strict requirement for SPFx web parts.
Your best shot would be to convince your ...
6
votes
How to retrieve pageContext in SPFx?
It is better to use correct type WebPartContext instead of any. Don't forget to put namespace.
import { WebPartContext } from '@microsoft/sp-webpart-base';
export interface WebPartProps {
context:...
6
votes
Accepted
Script to add SPFx webpart to a classic page using PnP Powershell
You can follow the below mentioned steps and after that you will be able to add your webpart to a classic page.
1) Go to your SharePoint workbench page (i.e https://tenant.sharepoint.com/sites/test/...
5
votes
Typescript errors in SharePoint Framework webparts
Recent changes in lodash module made it incompatible with typescript 2.0.x.
You can either upgrade typescript to 2.1.5 by running npm install typescript --save-dev or install previous definitions ...
5
votes
Accepted
SPFx(On-Prem) - Property for single choice of Office-IU-Fabric - PeoplePicker
In the office fabric UI, we have a property itemLimit that you can use to restrict the selection to a single person.
So, you need to modify it as below:
public render(): React.ReactElement<...
5
votes
Accepted
Send an email with SPHttpClient
You need to add an additional header, odata-version and set it to 3.
This error happens because SPFx's built-in SPHttpClient uses the odata-version header whose value is set to 4.
So, simply ...
5
votes
Accepted
Getting warning messages : Warning - [sass] The local CSS class 'min-chart' is not camelCase and will not be type-safe
Resolution
You should either fix all warnings or if it's not possible, you can ignore them.
For that purpose, you should modify your gulpfile.js.
There is one out of the box build suppression method ...
4
votes
SharePoint Framework Typescript typings
Adding external libraries with a CDN (such as jQuery) to an SPFx project can be broken down into a few parts:
Saving the types (for jQuery navigate to the folder through cmd, then put npm install --...
4
votes
Accepted
How does one pass parameters to SharePoint Framework Extensions in practice?
theChrisKent's answer set me on the right track, but as I noted in my comment on his answer, I was really looking for something that could be used from a web interface (such as a client side webpart), ...
4
votes
Accepted
Close propertyPane in sharepoint framework
Yeah, no good option available right now to close the property pane via API.
But then you can use document.querySelector to find the close button element and then programmatically trigger the click ...
4
votes
Accepted
Restrict audience for SharePoint Framework Solutions
You can restrict it to individual site collections by using the Site Collection app catalog which will ensure that SPFx webparts are only available in that specific site collection
Target audiences ...
4
votes
Accepted
How do i get current aspx sitepage with SPFx
It is available in the context info object itself in the serverRequestPath property.
In your code, you can consume it as below:
var currentPageUrl = this.context.pageContext.site.serverRequestPath;
4
votes
Accepted
Issues Loading External JS Library from CDN in a SharePoint Framework (SPFX) Web Part
Your external entry is correct. However, you should reference it in your code like this:
var statuspage:any = require('StatusPage');
4
votes
Accepted
Office UI Fabric Dropdown event onChange not working
I do observe the same here. Interestingly, the deprecated onChanged event fires and not onChange.
Works if extending a basecomponent and something is missing while extending React.Component. In the ...
4
votes
Accepted
Create document set with REST API in SharePoint Framework
You need to make 2 HTTP requests to get it working.
1st request will get the content type Id of the document set content type present in the SharePoint document library.
2nd will make use of the ...
4
votes
SharePoint framework yo not showing all the options
You have to select "SharePoint Online only (latest)" or "SharePoint 2019 onwards, including SharePoint Online" for the question Which baseline packages do you want to target for your component(s)? to ...
3
votes
SharePoint Framework: Loading icon in property pane
A little late to this answer, but you can follow the below approach:
1) Create 2 private variables, _listOptions of type IPropertyPaneDropdownOption and loadingIndicator of type boolean (set it to ...
3
votes
Accepted
Get SharePoint List Items using SharePoint Framework React
There will be return type ISplistitemsState instead of void in Splistitems class.
Change following line
export default class Splistitems extends React.Component<ISplistitemsProps, void> {
To
...
3
votes
SPX and Typescript - how to add references to SP.JS?
There is a specific guidance article describing how to use SharePoint JSOM with SharePoint Framework client-side web parts available at https://dev.office.com/sharepoint/docs/spfx/web-parts/guidance/...
3
votes
Accepted
Typescript errors in SharePoint Framework webparts
In the screenshot, i see that you are running the Node v6.9.4 . You should uninstall this Node version and instead install the Node v4.6.0 LTS version. Today SharePoint Framework requires Node.js 4.6....
3
votes
Accepted
SPFx - How to start workflow on list?
You can create a custom button to start a workflow on a List item. Here I have used SP services to achieve this. The whole logic lies in - how create a Url that redirects to Workflow initiation page? ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sharepoint-framework × 237spfx × 123
sharepoint-online × 98
spfx-webparts × 77
sharepoint-server × 20
react × 17
typescript × 16
javascript × 12
pnp-js-core × 11
spfx-extensions × 10
spfx-tooling × 9
office-ui-fabric-react × 8
reactjs × 8
development × 7
sharepoint-addin × 7
web-part × 6
rest × 6
sharepoint-rest-api × 6
pnp × 6
gulp × 6
spfx-custom-property-pane × 6
office-365 × 5
jquery × 5
error × 5
modern-experience × 5