Hot answers tagged

4

I think best way to include JS and CSS files into a SharePoint Modern page is using SPFx Application Customizer. SPFx application customizer will be loaded on all existing and newly created modern pages in SharePoint. Downside of using Script Editor web part is you have to add the same code on each page everytime you create a new page in your site. ...


3

If you truly want the most "flexible" way to customize list forms in SharePoint Online, you will want to create a custom SharePoint Framework (SPFx) WebPart, in which you could build an entirely custom JavaScript App, including your own entirely custom Form. Using this strategy, you will need to handle data saving/retrieving yourself through the Framework ...


3

You probably ran the gulp tasks for bundling and packaging without the "--ship" flag at the end, so it still connects to your localhost after deployment You can find some guidance here: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/hosting-webpart-from-office-365-cdn#prepare-web-part-assets-to-deploy


2

Application Customizer can be the better option to add script/css to Modern Page: Inject Custom CSS on SharePoint Modern Pages using SPFx Extensions SharePoint Online Branding Inject CSS Script Editor Web Part can't be used in ListView Page, while Application Customizer can be used for All Modern Page.


2

BaseWebPart class is something comes with @microsoft/sp-webpart-base package and componentDidMount & componentDidUpdate are methods of The Component Lifecycle of React. These are not related at all. So, you cannot write componentDidMount & componentDidUpdate methods in BaseWebPart class. However if you want to use the React components in your SPFx ...


2

You are right. It is not possible, nor wanted to use any React component lifecycle in BaseWebPart.


2

Try using if (this.context.sdks.microsoftTeams) instead of if (this.context.microsoftTeams). Property this.context.microsoftTeams has been deprecated starting from the v1.10 release and you should be using this.context.sdks.microsoftTeams. Source: Detecting if web part is in Teams context. Additional Reference: Get context for your Microsoft Teams tab. ...


1

I managed to both suppress the errors in the IDE and get the project to build by using ts-lint:disable as the first line in the file, while citing the exact rule(s) to disable, so something like /* ts-lint:disable:no-any max-line-length */ import Something from 'something'; export default class Foo { // etc }


1

Changing the function to return a resolved promise works as expected: public getDirectReports = async (manager): Promise<any[]> => { console.info(`** 2 - /me/directReports`); return new Promise<any[]>((resolve, reject) => { this.graphClientFactory .api(`/me/directReports`) .version("v1.0") .get(async (...


1

An async from function needs to return a Promise, then resolve that Promise. Thankfully, React makes things a little easier for you. If you return a Promise, then later in your function body return a value, React resolves the Promise with your returned data. If you return await *somePromise*, you don't actually return the Promise, but the result that ...


1

I found an answer that is acceptable for my case to one part of the question. On the landing page of a Comm Site (and other modern pages) there is a global function that can be called to open the advanced permissions panel. _spLaunchSitePermissions() Calling this on list pages or site contents throws a not defined error. There are some more functions like ...


1

You would basically do a map within a map, to loop through the divisions, then through the array within each division. Something like this: Object.keys(divisionGroupItems).map(function(division,key){ return(<div>{division} { divisionGroupItems[division].map(function(item, key) { return (<div>{item.Assignee} {item....


1

As Ganesh Sanap mentioned in the comment, sharepoint.aspx is an application page in SharePoint 2019, which is known as non-editable and should not be deleted. That is why SPFx Application Customizer does not work for this page. As far as I know, the only option would be to create a custom application page instead of modifying the default one. Reference: ...


1

In order to access values from the lookup column from a REST query, you need to add the $expand parameter to your REST URI to specify the name of the column to expand, then reference the fields in your $select prefixed with the Lookup columns name, the / character and the name of the field from the reference lookup item you wish to select. For example: /...


1

In general, rather than trying to reference the control, it is better to have your controls reference unique values in State so that you just need to call setState when you want to change the way it is rendering. I would suggest removing the isEdit State value, and adding a value such as editingItemId to your state, possibly defaulted in your constructor to ...


1

I figured this out. Instead of trying to change props in component B, assign props from the main component A, I have added a function in the state and called this function which is prop for the component B. StatusDropvalue={this.state.dropdownchanged?this.state.dropdownchanged:this.state.items.CurrentStatus} onNameChange={this.onChange} In Component B ...


1

The drawbacks you mentioned for the PowerApps are correct. However the simple customization's like disabling the fields or cascading the drop-downs or not allowing the users to update the closed items can easily be achieved using PowerApp Functions. For simple customization's: So, wherever you do not have complex scenarios like using enhanced rich multiple ...


1

Yes, super is the keyword that refers back the parent class. Any time you are overriding a method from the base class, it is best practice to call the parent implementation. You never know when the base framework has (or may add in a future version) has necessary code in the base class. Like nearly every coding standard, there are exceptions when you will ...


1

You mentioned that you are new to SPFx and O365 CDN, so I will assume that you are not very familiar with the current capabilities offered - apologies if this is not the case When using O365 CDN public CDN, you do not have to set any additional origins for your web parts, neither do you need to set the cdnBasePath on your project. When you enable the O365 ...


Only top voted, non community-wiki answers of a minimum length are eligible