spfx

How to create a handler function which 'handles' multiple textfields but also character counter textfields as well

谁都会走 提交于 2020-01-25 06:46:09
问题 this is a continuation of: How to use a handler function for two different purposes. SPFX (React/TypeScript) which I've made a little progress from, so this isn't a duplicate, it's part 2 as it were. My current code handler is: const {value} = (evt.target as any); const countKey = `${evt.target.name}Count`; const obj = { [evt.target.name]: value, [countKey]: value.toString().length, }; this.setState({ ...this.state, obj }, () => { console.log(obj), console.log(countKey+'countKey'), console

How to use a handler function for two different purposes. SPFX (React/TypeScript)

空扰寡人 提交于 2020-01-24 19:30:28
问题 I am creating an SPFX form (react/Typescript). I am using a handler function: public handleChange = (evt: any) => { const {value} = (evt.target as any); this.setState({ ...this.state, [evt.target.name]: value }); } To handle multiple text fields. What I want to do now is for this handler to cater for character count text fields. (I know I could have used labels!) These text fields count how many characters have been entered into each text field. I don't know how to write the code for this.

AadHttpClient fails when loading SP page with SPFx webpart in MSTeams Desktop Client

佐手、 提交于 2020-01-23 03:40:06
问题 I added a Personal Tab in MS Teams which references a SharePoint Page with on it an SPFx webpart using AadHttpClient . In the MS Teams Web Client the page loads as expected, and the AadHttpClient calls work. However, in the MS Teams Desktop Client (on windows) the AadHttpClient does not work. Looking in Fiddler, I can see the following happening (only on the dekstop client): A call is made to /sites/MyDevSite/_api/Microsoft.SharePoint.Internal.ClientSideComponent.Token.AcquireOBOToken

How to set a SharePoint list field using a pnp.sp People Picker

这一生的挚爱 提交于 2020-01-16 09:09:14
问题 I do not know the code to add the user, selected in a People Picker from the pnp.sp library. I've tried the below code example (by using State) but this I understand is not saving the users selection. private _getPeoplePickerItems() { pnp.sp.web.siteUsers.get().then((data) =>{ this.setState({ DeptContact: data }); }); } And the people picker in the render: <PeoplePicker context={this.props.context} titleText="People Picker" personSelectionLimit={3} groupName={''} showtooltip={false}

Microsoft Teams - downloading a file from within a tab

妖精的绣舞 提交于 2020-01-03 08:37:07
问题 I've created a configurable tab app and have side-loaded it into Teams. On the content page, I want to allow the user to download a file. Simply linking to the file doesn't work. When the user clicks the link, the content iframe redirects and goes blank. I've tested this in the web app version of Teams at teams.microsoft.com and it works fine. The file gets downloaded as you would expect. If it makes any difference, the content page is hosted in SharePoint on a modern page using SPFx. 来源:

How would I re-use these functions instead of having one per textfield?

落爺英雄遲暮 提交于 2019-12-25 01:24:05
问题 I'm learning spfx using SPO. I have a form which has several text fields. I have 2 class components. (A and B) Each time a textfield on (B) is typed into, a function sends the return to a props file. (This is called Lifting State up I believe). These props are then used by a handler function in (A) so whatever is typed can be submitted to an SP list by (A). This all works fine. But I've noticed that I'm creating functions for each and every textfield. Can someone tell me a way to re-use a

Why I am not able to authenticate with Microsoft Graph Explorer through Sharepoint Custom Web Part only in Edge Browser

倾然丶 夕夏残阳落幕 提交于 2019-12-23 04:41:40
问题 I have deployed a custom web part on sharepoint online, in which I am authenticate with Microsoft Graph Explorer. It is authenticated through Sharepoint Custom Web Part successfully in Chrome , IE and Firefox but not authenticated in Edge . In Edge I've getting below error: description: "Invalid argument" message: "Invalid argument" number: -2147418113 stack: "TypeError: Invalid argument at Anonymous function (https://spoprod-a.akamaihd.net/files/sp-client-prod_2019-05-31.012/sp-pages

SPFx web part is not loading in IE 11

久未见 提交于 2019-12-11 16:44:28
问题 I have a SPFx web part with Knockout framework. Its developed for SharePoint on premises (V1.1.0). Deployed all the Assets in the SharePoint library. Application is working fine in Chrome. But in IE, web part is not loaded in the page. Even I have not any console logs/errors. If I refresh the page with developer console open, it works. I have removed all my console logs in the application, even I have removed the console logs from the bundled JS. Still web part is not loaded. Then I thought

How to re-render react component when a property changes

僤鯓⒐⒋嵵緔 提交于 2019-12-11 15:56:51
问题 so I have this react component, with a dropdown property (SPFx) which has 2 values, I need that when the dropdown is changed the react is re-rendered again, the dropdown defines the datasource from where the values will be retrieved. Webpart.ts import * as React from 'react'; import * as ReactDom from 'react-dom'; import { Version } from '@microsoft/sp-core-library'; import { BaseClientSideWebPart, IPropertyPaneConfiguration, PropertyPaneDropdown } from "@microsoft/sp-webpart-base"; import *

SPFx can't use JQuery?

旧时模样 提交于 2019-12-11 05:36:33
问题 I'm working on a brand new SharePoint Web Part using SPFx created by Yeoman, the scaffolding template is fine, adding the NPMs for JQuery and JQueryUI also get not a single problem, I see GULP SERVE running in the background without any errors. The problem happens when I add the following line inside my JQWebPart.ts: import * as jQuery from 'jquery'; Once the line above is added the GULP SERVE outputs a very long list of errors, below are the last lines from all the errors: [16:54:06] Error -