Questions tagged [typescript]

This tag is for questions specific to developing for SharePoint with TypeScript. It is not used for general JavaScript questions. TypeScript is a statically typed superset of JavaScript created by Microsoft that adds optional types, classes, interfaces, enums, generics, async/await, and many other features, and compiles to plain JavaScript.

Filter by
Sorted by
Tagged with
0
votes
1answer
18 views

Use SharePoint Theme colors in SASS exported variables

I want to apply the color palette of the selected SharePoint theme to a SPFx webpart by setting a set of variables I export from the SPFx webpart's .scss. I want to define the colors as exported ...
0
votes
2answers
38 views

SPFX - How to suppress TypeScript errors in the terminal so the app can compile?

I have tried using // @ts-ignore which removes the error from my IDE, but in the terminal the error persits so the app does not compile. Any idea how to get around this? https://www.npmjs.com/...
0
votes
0answers
8 views

How can I auto-logged an user inside a Sharepoint Web Part?

I have a website "Play web". When I want to access into this site I have to login previously with user/pass. An authtentication module, handle this info and starts a communication with an Azure AD. If ...
0
votes
0answers
12 views

How can I get the user token from the context in a Sharepoint WebPart?

I have been working in a Sharepoint Webpart with TypeScript. I would like to obtain the user token to pass it as a parameter in the headers. How can I do this?. So far, I have something like this: ...
0
votes
1answer
22 views

Uncaught (in promise) TypeError: sort is not a function react spfx

var currStatus = ''; var job = [...this.state.data]; return <div> { job.length ? <div> { Object.keys(job).forEach(jobTree) => ...
0
votes
1answer
26 views

Spfx source files from spkg

Inlost my source file of spfx webpart. I only have spkg package can i extract source field from spkg please help mei it's urgent
0
votes
2answers
117 views

Call typescript function on button onclick event in SPFx(No Javascript Framework)

I am having trouble in calling typescript method on button click in SPFx with no JavaScript framework. for Example: private _renderListCustomer(items:ISPListCustomerItem[]):void{ let html:string=...
0
votes
1answer
38 views

SPFX : Undefined Hammer while trying to load third party javascript

I have create a custom SPFX webpart and what I'm trying to do is to convert the HTML and JQuery flipbook into SPFx webpart. I've download this plugin and add all the reference. However, when it is ...
2
votes
2answers
52 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
0answers
56 views

How do I change the TypeScript version used by gulp? [duplicate]

In SharePoint Online, how do I update my typescript version? I think I narrowed down my problem to typescript versioning. My helloworld web part works. The one thing that it has that many of my other ...
0
votes
0answers
12 views

ValidateUpdaeListItem Ajax

I would like to post an ajax call to update a list without updating the version. I was told I can make use of the ValidateUpdateListItem() function. However, when I try using it, I have the error: ...
0
votes
0answers
114 views

What are the supported office UI fabric versions for SPFX 1.1.0

There are many threads and answers regarding this question. But i didn't find a satisfying answer. I am currently working on a SPA for SharePoint 2016 OnPrem. I scaffolded my Project with the Yeoman ...
0
votes
0answers
9 views

Are there typings for the SharePoint and MS Project JSON objects you get from the REST APIs?

I'm working on an SPFx webpart that is going to interact with Project Server, and I'm finding myself setting up things like this: export interface ISelectProjectModalProps { allProjects: any[]; ...
1
vote
1answer
368 views

Get current theme colors for SharePoint Online site in SPFx webpart

I have a SharePoint Online site with green theme color currently set. In my SPFx webpart I want to be able to get the current theme color (primary, secondary and tertiary) in TypeScript code. Below ...
0
votes
0answers
89 views

Jest with SharePoint Framework. SyntaxError: Unexpected token export

I'm trying to do tests on an SPFx project with Jest and Enzyme. I have configured the environment using Andrew Connel's preset to test my solution with React and Typescript. After run 'npm test' I've ...
1
vote
1answer
107 views

Property 'select' does not exist on type 'Web'

I'm trying to use @pnp/sp with SPFx like shown on pnp GitHub page: sp.web.select("Title").get().then(w => { console.log("title: " + w.Title); }); When compiling the following TypeScript error ...
0
votes
2answers
114 views

import interface in mystrings.d.ts

I want to add multiple languages to my spfx web part. Now I want to import some interfaces to my mystrings.d.ts declaration file. But when I do that it breaks the definition and I get a lot of errors ...
0
votes
0answers
30 views

File not found error JSOM Sharepoint file uplaod

The code was working perfectly and suddenly this error: "Request failed with error message - File Not Found. Stack Trace - undefined" comes out, can some please help me? onFileSelected(event) { ...
0
votes
3answers
389 views

Sharepoint Online No JS Framework, how can redirect to one modern page to another?

I am using: window.location.replace('https://site.sharepoint.com/sites/contosoSite') Also I tried using href. The problem is that when I clicked on the button for redirection the new page is ...
0
votes
0answers
72 views

PnP JS Core : Uncaught (in promise): TypeError: Cannot read property of undefined

I am using PnP js in one of my angular 6 project. I have a function which is defined in the Component, but I am getting this error at run-time when calling from inside the success of PnP SP js: ...
0
votes
0answers
32 views

Sharepoint Online Only, Web Part: Trying to query SQL Server

Let me first say that I'm sorry if this post seems rather vague. I've been trying for weeks now to connect to SQL Server from a custom Web Part i'm creating using Visual Studio Code, TypeScript, Node....
0
votes
1answer
265 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:...
0
votes
0answers
60 views

How to display content of Rich text on webPart

On my SharePoint list, I have a rich text with picture. When I retrieve it on my webPart, the picture doesn't get displayed. I obtained plain text but how can I display picture. i already tried this ...
0
votes
1answer
891 views

How make accordion detail list with UI fabric react

I start with UI Fabric react; I am developing a FAQ; I use for that a list; but the result is not good; I want to do something looks like an accordion, where we can see the question as a header and ...
0
votes
1answer
33 views

How use result of pnp response

I use PnP for getting SharePoint list item. But I don't really know, how use the result of my function. I wish to get items of my SharePoint list using PnP and assign it to my list. My code don't ...
1
vote
3answers
187 views

get sharepoint list with pnp [closed]

I want to get a sharepoint list and assign it to my list 'items' which of type is IExampleItem, but I don't really know how to do it; I tried the following code but it gives me an error, my list '...
0
votes
1answer
48 views

How show a value when clicking on a table row

I am a beginner with sharepoint and typescript, i have dynamic table, and i want to get value of row when i click on private _renderList(items: ISPList[]): void { let html: string = '<table ...
0
votes
1answer
82 views

Assign permission of the current user to a list item programmatically

I am making an event web part which is connected to a list of items. When a user attends an event, a json object will be parsed to a txt document that is attached to that particular list item /event. ...
0
votes
1answer
71 views

Q: Set Folder's path according to it's title in a list with SPFx

I am creating a folder inside a List with the following code: TypeScript import {sp} from "@pnp/sp"; const shpList = sp.site.rootWeb.lists.getById(ListId); shpList.items.add( { Title: folderName, ...
1
vote
2answers
486 views

Q: Create list item inside folder with SPFx

I am trying to create an item within a folder in a list. Is there an approach with pnpjs that looks like the following? TypeScript import {sp} from "@pnp/sp"; const shpList = sp.site.rootWeb.lists....
0
votes
2answers
90 views

Q: Create visible folder in list with SPFx

Having the following code in an application extension: TypeScript import {sp} from "@pnp/sp"; /*******************************************************************/ const shpList = sp.site.rootWeb....
1
vote
0answers
84 views

(Problem)SPFx rendering items from RSS after selecting number of items you want to display with slider

I am currently building an RSS webpart in SPFx using React as a framework. Now I am in the stage that I want the user to be able to select how many news items he/she want to see with a slider (taken ...
0
votes
1answer
109 views

SPFx React webpart is not displaying all XML items from RSS News Feed

I am currently building an RSS News Feed in SPFx using React as a framework and using an XML link https://feeds.expressen.se/nyheter/ (Swedish news if curious). I can display all items, in this case ...
1
vote
0answers
171 views

Issue with rendering XML data in SPFx

I am in a project of making a RSS feed in SPFx and using React.js and TypeScript. When I try to retrieve XML data from a news site, the console gives error: Because it complains about CORS, so I ...
0
votes
1answer
106 views

Call child component method in parent and visa versa

how can I call a parent components methods from child or visa versa. I'm using reactjs and typescript in spfx webpart. Or should I use helper classes to call methods of another classes from anywhere?...
0
votes
0answers
469 views

Q: Get item URL from a lookup field using pnp/sp javascript library

Set up: Something that may be relevant is that the Sharepoint is in spanish. The script accesses a list to know if the current user has read the mandatory information. This list has a reader field and ...
0
votes
0answers
31 views

Extend Document Information Panel (DIP) with Data from API

The document information panel in SharePoint Online modern view Document Library shows the properties configured in the Site Content Type as well as general sharing or modification information from ...
0
votes
1answer
190 views

Problem with SPFx TypeScript json.value.map(k,i) & query via getuserbyid()

Firstly I'll start with extra question: I'm trying to get data by _api/web/getuserbyid() API call in code. Do You guys know why there is no option for filtering by query for specific data? I mean by: ...
0
votes
1answer
92 views

Make web part compatible for IE11

I have a web part that works for every browser but not in IE. It seems to have troubles with "startsWith" which is a function that is not supported in IE11, fair enough. But when I changed the code ...
0
votes
0answers
601 views

SPFx TypeScript json response from spHttpClient as array

i want to get data to WebPart from the SharePoint list. but some of the data are eg. PeoplePicker or Multiple line of text and I have result shown as: <div class="...
0
votes
1answer
335 views

SPFx web part: wait for fetching data before rendering header

I already asked this question regarding SPFx extensions. But now I have the same problem I had in that question, but for a SPFx Web part. I use the exact same _getUserInformation() method as ...
0
votes
1answer
776 views

SPFx Extension: wait for fetching data before rendering header

I am currently developing a SPFx Extension (Application Customizer). I am relatively new to TypeScript (C# developer) and I can't find my error. I have the following onInit method: @override ...
1
vote
1answer
673 views

SPFX- Lookup column value

I'm retrieving data from a SharePoint list and I'm facing some issues while getting values from lookup column. I was able to successfully pull in the 'Title' column which is a single line of text, but ...
0
votes
1answer
553 views

SPLoaderError loadComponentError

I clone the mentioned SharePoint App. Did a npm install. When I run gulp serve, it shows the following error. Please do the needful. [SPLoaderError.loadComponentError]: ***Failed to load component ...
0
votes
1answer
108 views

How to send mass emails with only BCC recipients but not To?

I am trying to send some subscription emails, need all the email addresses in BCC. I tried something like this const requestUrl = `${this.baseUrl}/_api/SP.Utilities.Utility.SendEmail`; const ...
0
votes
0answers
174 views

SPfx CKEditor 5 adding additional plugins

hopefully i'm not being too dense here. We have a requirement that a WebPart includes the CKEditor V5. But we need to implement some of the third party plugins that are listed on the CKEditor website. ...
2
votes
1answer
543 views

Using TypeScript global variable with SharePoint functions

Using TypeScript and Angular, I have created a function named getTasks() that I want to fire when a modal is closed. This is the function: getTasks() { this.http.get(`https://example.com/_api/web/...
2
votes
2answers
44 views

Where is the documentation for javascript for the pnp libraries?

I am trying to build a SharePoint Add-In and I am struggling because all documentation seems to be in TypeScript. I am sure TS is great but I don't have time to learn it right now. Does MSFT not have ...
2
votes
0answers
1k views

@types/react and @types/prop-types errors when building with gulp build or gulp serve

For my team's project, some of us are hitting a type issue when building. We're using version 1.7.0 of all the @microsoft/sp- packages. tslint version: 5.9.1 typescript version: 2.4.2 Build tools ...
1
vote
1answer
922 views

Get current folder within SharePoint document library with @pnp/sp

I need to get the folder name within a document library, within the ListCommand spfx extension. Is there a way to do that with REST ? can I use @pnp/sp ? I have imported the project with : import { ...