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
0 answers
44 views

Filtering users in AD using SPFx Typescript

I followed the following solution from GitHub. I am trying to get the users from specific "UsageLocation", i.e. US, by adding it in an additional filter. In the code below, I added Filter ...
user avatar
  • 1,787
0 votes
1 answer
28 views

Changing title text in SharePoint top navigation bar using TypeScript/JSOM

I'm trying to change the title of the first item in the top navigation bar in a SharePoint 2019 modern site. The code is run in a TypeScript web part. My code below runs fine and no errors are ...
user avatar
  • 333
0 votes
1 answer
55 views

npm install command error

Sample:(PS: You can find what I tested in the GitHub link below) https://github.com/pnp/sp-dev-fx-webparts/blob/master/samples/react-mgtEvents/src/webparts/mgtEvents/MgtEventsWebPart.ts Problem: Hello,...
user avatar
0 votes
1 answer
97 views

Sort items inside my React.Js SPFx web part

I have a SharePoint list, and i want to order the items based on the "Featured" field, but things is not working, where if i define this ordering logic:- a.map(b => { if (b ===...
user avatar
  • 2,224
0 votes
0 answers
30 views

Show 3 boxes inside 2 columns instead of 3 columns inside my SPFX React sharepoint web part

I am trying to achieve this layout inside my SharePoint SPFx web part:- But currently i have this layout:- Here is my full code and description:- I have a custom list inside my SharePoint online ...
user avatar
  • 2,224
0 votes
1 answer
64 views

Function wait for a loop before returning value in javascript

My function return value of an array before pushing value into array. private async getPPickerid(ppvalue,AssignedToIdArr):Promise<any> { return new Promise<any>((resolve, reject) => { ...
user avatar
0 votes
1 answer
259 views

How to get the current Page title >> then filter list items based on it inside my SPFx web part

I have a custom list named CompanyNews which contain these fields: Title --> Free Text Topic ---> choice which allow multiple selections Where inside the custom list, we will be adding the ...
user avatar
  • 2,224
0 votes
1 answer
75 views

How to defer executing JavaScript file in SPFx solution

In a SPFx solution, I'm importing a JavaScript library like this: import './javascriptfile.js'; This JS file gets executed before the DOM is ready. If we are using a SCRIPT tag, we can use defer ...
user avatar
0 votes
1 answer
20 views

Metainformation about SharePoint structures for typescript/JavaScript?

Hi all I think it is easier if I try to explain with an example. So if I want to add a field using xml I need to populate the xml based on what data a field of an specific type can have. SharePoint ...
user avatar
0 votes
0 answers
51 views

SPFx WebPart started giving TypeError: Cannot read property 'Content' of undefined

This webpart was working on a classic Publishing site. Recently, it started throwing this error message: Error details: Error: Error initializing application. Error: TypeError: Cannot read property '...
user avatar
  • 492
0 votes
1 answer
445 views

"gulp package-solution" will raise this warning "- [package-solution] This is not a production build (--ship or --production).."

I am following the steps inside this link @ https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/serving-your-extension-from-sharepoint to deploy my SPFX extension of type ...
user avatar
0 votes
2 answers
409 views

Graph Api call with filter query

How can I filter the API call dynamically passing through variable? I am getting value in this variable through another API call: var userid; this.props.context.msGraphClientFactory.getClient().then(...
user avatar
0 votes
1 answer
20 views

Why is temp array changing my state array? Sharepoint 2019 on premise, React, Typescript

I do not know why function setHours() that should work only on tempEvent is also changing my state this.state.events (it sets hours of my dates to 00:00:00. let tempEvent = this.state.events[i][&...
user avatar
  • 27
0 votes
1 answer
22 views

Create a webpart with typescript / sass

I created a webpart for a footer and I have to insert an image in the footer and I can't get it to display. I am using typescript and sass. It is my first webpart! <p class="${styles.subTitle}...
user avatar
0 votes
2 answers
236 views

Passing variables in Query string in tsx file (react +typescript)

I am trying to pass plainid and id as a parameter in query string in URL. {planid = item.planId} { id =item.id} <td><a href="https://tasks.office.com/credentinfotech.com/en-GB/...
user avatar
0 votes
1 answer
104 views

Fetching the data through Graph API in the webpart using sharepoint framework

[I am trying to fetch my email messages through Graph API into the webpart in sharepoint framework] In the webpart Not getting the details of my emails through Graph API Error : Cannot read property ...
user avatar
1 vote
1 answer
120 views

Problem with creating an instance of a class in SPFX(TypeScript/React)

I am facing a problem with creating an instance of a class in SPFX. I am not sure what I should put in as a parameter. The compiler complains on whatever I put as a parameter. Here is my code: import {...
user avatar
  • 47
2 votes
2 answers
168 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']; ...
user avatar
0 votes
2 answers
5k 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 '...
user avatar
0 votes
2 answers
37 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 ...
user avatar
0 votes
1 answer
54 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
user avatar
0 votes
0 answers
119 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: ...
user avatar
0 votes
1 answer
459 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 ...
user avatar
  • 37
0 votes
2 answers
250 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 ...
user avatar
0 votes
1 answer
23 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 ...
user avatar
  • 11
0 votes
1 answer
76 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/...
user avatar
0 votes
2 answers
125 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 ...
user avatar
  • 4,016
0 votes
1 answer
124 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 ...
user avatar
0 votes
1 answer
293 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 ...
user avatar
  • 333
0 votes
2 answers
6k 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 = ...
user avatar
0 votes
1 answer
37 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 ...
user avatar
0 votes
1 answer
2k 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>...
user avatar
0 votes
1 answer
126 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 '...
user avatar
  • 101
1 vote
0 answers
47 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 ...
user avatar
2 votes
0 answers
93 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. ...
user avatar
1 vote
2 answers
418 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 ...
user avatar
0 votes
2 answers
127 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 "...
user avatar
  • 27
0 votes
0 answers
42 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 ...
user avatar
1 vote
1 answer
217 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 ...
user avatar
  • 27
0 votes
2 answers
417 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 ...
user avatar
0 votes
1 answer
103 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<...
user avatar
0 votes
1 answer
455 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 ...
user avatar
0 votes
0 answers
48 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 ...
user avatar
1 vote
1 answer
148 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.
user avatar
0 votes
1 answer
38 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 ...
user avatar
  • 41
0 votes
1 answer
216 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 ...
user avatar
0 votes
2 answers
641 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/...
user avatar
  • 396
0 votes
1 answer
530 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) => ...
user avatar
  • 47
0 votes
1 answer
240 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
user avatar
  • 87
0 votes
2 answers
2k 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=...
user avatar