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
1 answer
21 views

What is the best way to shuffle the results that come back from a Graph query?

I have an SPFx web part for SPO which gets the members of a team. What's the best way to shuffle the 'result' data that comes back? EDIT: I have tried this: result = result.sort(() => Math.random() ...
0 votes
1 answer
90 views

Trying to get all the members of an M365 group using SPFx

I am trying to use the code here in order to get all the members in an M365 group. ¨PnPJS Graph : how to list all members of a Group I am getting an error Uncaught (in promise) Error: There is no ...
0 votes
0 answers
7 views

Confirm resource booking before an event is created / email is sent

I am building a room booking application and I've came to the part where I'm able to perform a booking - but I wan't to verify that booking a resource goes through and that it's accepted. From what I'...
  • 23
1 vote
0 answers
35 views

Create client instance for reuse

I was trying to set up an instance of client so I don't have to write this.context.msGraphClientFactory.getClient().then((client: MSGraphClient) every time I want to make a request. Something which ...
  • 23
1 vote
1 answer
72 views

Building a react application with Microsoft graph and SharePoint

I’m starting a new job and been tasked with creating a react based application which will be built in SharePoint and retrieve data using Microsoft Graph. I am new to this and am struggling with ...
  • 23
0 votes
0 answers
28 views

read uploaded excel sheet file and loop through its items to update a SharePoint site column choices inside our SPFx

We have the following Panel to manually add/delete choices inside a SharePoint column named Category:- and here is the related .tsx code for the above Panel:- import * as React from "react";...
  • 982
0 votes
0 answers
88 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 ...
  • 1,787
0 votes
1 answer
46 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 ...
  • 343
0 votes
1 answer
110 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,...
0 votes
1 answer
247 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 ===...
  • 982
0 votes
0 answers
35 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 ...
  • 982
0 votes
1 answer
280 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) => { ...
0 votes
1 answer
595 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 ...
  • 982
0 votes
1 answer
124 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 ...
0 votes
1 answer
30 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 ...
0 votes
0 answers
134 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 '...
  • 512
0 votes
1 answer
711 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 ...
0 votes
2 answers
524 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(...
0 votes
1 answer
42 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][&...
  • 27
0 votes
1 answer
23 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}...
0 votes
2 answers
338 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/...
0 votes
1 answer
154 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 ...
1 vote
1 answer
157 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 {...
  • 47
2 votes
2 answers
203 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
2 answers
8k 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
2 answers
40 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
1 answer
74 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
0 answers
158 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
1 answer
624 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 ...
  • 37
0 votes
2 answers
377 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
1 answer
27 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 ...
  • 11
0 votes
1 answer
190 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
2 answers
170 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 ...
  • 4,038
0 votes
1 answer
145 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 ...
1 vote
1 answer
404 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 ...
  • 343
0 votes
2 answers
8k 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
1 answer
45 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
1 answer
3k 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
1 answer
156 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 '...
  • 101
1 vote
0 answers
59 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 ...
2 votes
0 answers
110 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
2 answers
486 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
2 answers
176 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 "...
  • 27
0 votes
0 answers
43 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
1 answer
270 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 ...
  • 27
0 votes
2 answers
508 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
1 answer
145 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
1 answer
665 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
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 ...
1 vote
1 answer
219 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.