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
2
votes
2answers
30 views

Not able to insert data into TaskList In sharepoint Spfx

Using SP-Pnp-Js Library, I am not able to insert data from a webpart into the sharepoint Tasklist. private SubmitWorkflowForm(): void { var TaskNameVal = document.getElementById('taskName')['value']; ...
0
votes
0answers
18 views

Copy documents from document library A to document library B

I have a requirement to develop a solution based on SPFx, namely, copy main versions of a documents from document library A to document library B. I have tested copyto (PnP.js) but it only copies the ...
0
votes
2answers
29 views

Promise is missing properties

When I try to create array, to put the results in the array, then I get the following error message: const allItems : any [] = sp.web.lists.getByTitle("Documents").items.get(); Type '...
0
votes
2answers
28 views

When a document is deleted or published in a document library

I have a requirement to develop a solution based on SPFx, namely, when a document is deleted from a document library or a document is published (got main version) in a document library in SharePoint ...
0
votes
1answer
25 views

Teams Tab is not able to load in Teams Desktop Application using Microsoft Teams Toolkit

My app is visible in ms team application when open in browser My application is not visible in MS team desktop application Please help to resolve my error in Team Desktop application
0
votes
0answers
18 views

Microsoft Teams Tab is not able to fetch SharePoint List Data

Is there any way, so that my "Teams Tab" could fetch the value from SharePoint list's data? I have used SP PnP JS library in SharePoint SPFx to build this solution. I have Sync this ...
0
votes
0answers
11 views

Command extension visibility after promise resolve

I have command extension on all list and i need to show custom NEW button if list contains certain content type identified by NAME, not ID If I do this ctPromise: Promise<any>; public ...
0
votes
0answers
24 views

Teams showing - Can't load the application on this page

I created a new application using SPFx in SharePoint online. I have sync the sppkg solution file to the Microsoft Teams. But when I am adding the application in the teams Tab its showing an error: ...
0
votes
1answer
22 views

VideoPlayer using React and Typescript

Being new to typescript , I have been struggling with its implementation lately using it on the webpart.tsx file With the help of the posts here , was able to get to the point where the video plays ...
0
votes
0answers
11 views

Component Inheritance from Property Pane

I want to know if it is possible for other react components created within the spfx project to inherit property pane properties from the root class and if yes how does one go about it???
0
votes
2answers
35 views

Running two REST APIs sequentially in SPFX webpart (SharePoint Online)

I'm new to typescript and spfx SharePoint online webpart development. I've got a requirement where I need to run a REST api and wait for its result before I run the next one. I am kind of lost. I'm ...
0
votes
0answers
41 views

Cannot upgrade typescript version of SPFx project “Error - [tslint] error TS5023: Unknown compiler option 'declarationMap'.”

I have a SPFx solution with typeScript 2.4.2 that I want to to upgrade to 3.3. I follow this guide: https://www.eliostruyf.com/define-the-typescript-version-you-want-to-use-in-sharepoint-framework/ ...
0
votes
1answer
19 views

Is there an internal variable or something like it that indicates when all the Rest API calls in a SPFx webpart are done?

I have about 200+ Rest API calls in a SPFx webpart (TypeScript and JSON). Most of them are asynchronized. Everything is working fine. I just need to know when all the calls are done so I can save the ...
0
votes
0answers
27 views

Service Injection to React Component (is missing type“nameofmyinterface” []: length, pop, push, concat, and 16 more (SPFx))

I have this service that gets all the list items from a Sharepoint List (Promise) public getVehicles(): Promise<IVehiclesListItem[]> { let promise: Promise<IVehiclesListItem[]> = new ...
0
votes
1answer
20 views

Get particular columns with SPFx?

Im developing some web parts with SPFx and one of the things I'm trying to do is get certain coluumns from a list to display them. I use the guide https://docs.microsoft.com/en-us/sharepoint/dev/spfx/...
0
votes
0answers
24 views

How to make foreach on Array when Array.from error occurs?

have HTML table. Need to take all elements from first column (ProtocolNo) and change it into link. When tried to use Array.from i get an error: error TS2339: Property 'form' does not exist on type '...
0
votes
2answers
29 views

React webpart OnClick event fail to call a module function

I am working on a React spfx webpart. I inserted below code in my tsx file: <a href="#" className={ styles.button } onClick={ ()=> alert('greeting!') } > <span ...
0
votes
1answer
41 views

PnP Provisioning templates in PnP Js

XML-based PnP Provisioning templates are available to be consumed via SharePoint PnP PowerShell. Question: Is there something similar for provisioning lists via JavaScript/TypeScript via pre-created ...
0
votes
1answer
35 views

sp-pnp-js gives error when building TypeScript project

I've been asked to make changes to a TypeScript project and compile it to get a new JavaScript file. The JavaScript file is just to be referenced from a SharePoint site, so there's no SPFx involved ...
0
votes
0answers
21 views

function not getting called onkeypress event of the input element

I am trying to allow only numeric input in a textbox...For this I am writing a code as follows: '<input type="text" id="txtFlexibility" class="form-control input-sm" ...
0
votes
2answers
513 views

How to filter the retrieved items using a pnp-js-core REST call to a SharePoint list

As I am new to Sharepoint framework , I am trying to filter the retrieved list items from sharepoint list. Please find below code: pnp.sp.web.currentUser.get().then(function(res){ var userEmail = ...
0
votes
1answer
23 views

How to pad a number with leading zeroes using No javascript framework version in SPFx webpart?

As I am new to Sharepoint Framework, I am trying to generate request ID for the request form using the pad function for adding leading laeding zeroes using No javascript framework version in SPFx ...
0
votes
1answer
274 views

Property 'selectedOptions','selectedIndex','options' does not exist on type 'HTMLElement'

I am working around with typescript in Sharepoint framework using No javascript approach. To get the dropdown text I am using the below code but it is not working: var dept = (<HTMLElement>...
0
votes
1answer
19 views

Not able to fetch data from particular list item of site content using React APP WEB-part

I am able to fetch the list which we see on the landing screen of the site-content. However, when I am trying to fetch data by finding a particular item by its title I get an error CANNOT FIND LIST '...
0
votes
0answers
21 views

SPFx define custom config folder for building solution

Is it possible, to somehow define which config folder gulp will take while bundling. Saying i will have a build script for each sppkg solutions gulp clean && gulp bundle --ship && gulp ...
1
vote
0answers
27 views

SPFx monorepo with shared typescript code

Tasks are: Having multiple similar sibling folders each contains spfx projects with one webpart, and ability to develop each separately and build each own .sppkg file for a separate deployment. ...
1
vote
2answers
109 views

SPFx - Update a calculated column formula

I am trying to use this.context.spHttpClient.post() to update a calculated column formula in my SPFx WebPart. I get a status code of 400 with the error message: "The parameter __metadata does not ...
0
votes
0answers
30 views

How to retrive view data for a grouped view using pnp/sp

I need to retrieve the grouped view data as describled in this post using PNP/SP@1.2.8: https://piyushksingh.com/2016/11/21/retrieve-grouped-listitems-sharepoint/ Meaning I need the aggregated group ...
0
votes
2answers
34 views

Comparing images typescript react sharpoint framework

I am having a problem trying to compare two images with each other. One image is saved locally in my project and the second picture is on the internet (url). I tried putting the image into "...
0
votes
0answers
31 views

SharePoint Document's Library metadata duplicates after REST call

I am making a POST ajax request to a SharePoint Document Library folder to save a file along with some metadata. The file and the metadata are saved correctly however, the metadata are sometimes(not ...
1
vote
1answer
62 views

MS Graph returning undefined response

I am trying to get an image of a user with the help of MS Graph. However, a response is always undefined and there is no error given but If I run a query on MS Graph Explorer I get the full image of ...
0
votes
1answer
113 views

How to use the webpart's property pane to edit data in read mode using openDetails()?

Let's say I have a modern O365 SPFX WebPart that displays some data in a DetailsList in a SharePoint Online environment. Now, I want to use the same property pane that is used to edit the webpart's ...
0
votes
1answer
28 views

In a SPFx Web Part, how can I extend JQuery with TypeScript?

In order for a JQuery plugin called sliderkit to work I had to add a property in JQuery's interface. I've added one line in it: interface JQuery<TElement = HTMLElement> extends Iterable<...
0
votes
1answer
32 views

How to get File names from a Document Library using a REST GetByTitle query and TypeScript?

I am firing this query: _api/web/lists/GetByTitle('MyLib')/items?$select=Title,File/Name&$expand=File/Name I am getting a bunch of files, I see the names I want when running the query in the ...
0
votes
0answers
21 views

In a modern SPFx Web Part, how do I check if a URL exists? [duplicate]

I am creating a Web Part that shows a video that might or might not be in another Document Library. If the video exist, I should display it. If it doesn’t, I should display another video. How can I ...
1
vote
1answer
18 views

How to change the default value of propertyPanePageTitle in Property pane?

I working on my first spfx web part using TypeScript, now i want to change the default value of propertyPanePageTitle, how can I do that? Thank you.
0
votes
1answer
29 views

getting file error or bank when adding to sharepoint list attachment

I am getting a data serialize I think that is causing an issue with POST request, its getting success but the pdf or any file when I try to view from the source it generates error or blank image. How ...
0
votes
1answer
95 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
162 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
11 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
21 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
128 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
51 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
753 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
76 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
78 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
119 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 ...
2
votes
0answers
241 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 ...
1
vote
1answer
1k 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 ...
1
vote
1answer
265 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 ...