Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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
11 views

Using an SPFx Application Customizer in SharePoint 2019 on-prem to display SharePoint List Data

I am struggling to put the final step of this project together successfully. I can create banners and display static information that is able to be deployed successfully, however when I try and add ...
Alexander Lange's user avatar
0 votes
1 answer
49 views

Typescript custom action deploying banners with SharePoint 2019 list item data

I have a HelloWorldApplication which is in a development environment using gulp serve as the deployment. I am able to deploy the solution to a page, which renders banners on the top and bottom of the ...
Alexander Lange's user avatar
0 votes
0 answers
14 views

Property 'context' is missing in type '{}' but required in type 'IBreadcrumbsProps'

I have the breadcrumb declared in the component file and importing the class into another component file. But I started getting the error message Property 'context' is missing in type '{}' but ...
striker92's user avatar
  • 113
0 votes
0 answers
57 views

TypeError: Cannot read properties of undefined (reading 'operation')

I have the spfx extension which renders the items into commandBar from the term store, however when I try to access the page the extension is not loading and throwing the below error tmessage. When I ...
striker92's user avatar
  • 113
0 votes
0 answers
25 views

Breadcrumb Navigation issue when navigating to Sitecontents

I have the Breadcrumb navigation installed in my sites which works fine when navigating to the Lists or Libraries. But when navigating to Site Contents it cannot get the serverrelativeurl. Is it know ...
striker92's user avatar
  • 113
0 votes
0 answers
25 views

Office Ui react commandBar show menus on mouseover

I have top navigation which is using office Ui react commandBar, where i have to click on the menu to show the 2nd level of the menu. Is there anyway to add the hover effect to this commandBar or ...
striker92's user avatar
  • 113
0 votes
2 answers
72 views

Adding a dropdown to an SPFx custom webpart

I am new to building custom webparts. How do I add a simple dropdown list to a custom webpart. I am using the react framework and the myWebPart.ts file to do the majority of my work. Thanks
Java Uzumaki's user avatar
0 votes
1 answer
49 views

How to compile a package which depends on @microsoft/*

I'm trying to create a reusable SharePoint utility library. I want to use heft to build the library, because it will deal with scss typings, and both cjs/esm outputs. However, SharePoint's ...
Steve B's user avatar
  • 7,508
0 votes
2 answers
158 views

How can I upgrade the TypeScript version in SharePoint 2019 Project?

I'm trying to use [email protected] and Fluent8 in a new SharePoint 2019 project When running, it shows some TypeScript syntax errors like this: ... Starting subtask 'tslint'... Starting subtask '...
LanMegumi's user avatar
0 votes
1 answer
169 views

Pnpjs, How to surpress "Object is possibly 'undefined'" ts error on SharePoint context functions

For example I SP function, for example to format a date: const friendlyDate = new Date().format("dd.MM.yyyy"); console.log(friendlyDate); You can run in in Dev Tools on SharePoint page: ...
Gennady G's user avatar
  • 1,623
0 votes
1 answer
887 views

How to add @odata.nextLink in graph api request

I've a service to get all users from Azure AD. public getAllUsers(): Promise<Array<Person>> { return graph .users .select("displayName", "accountEnabled"...
Propool's user avatar
  • 37
0 votes
0 answers
22 views

What is listener and subcriber in pnpjs/logging?

I'm a newbie to SPFx, I have a task to create a custom logger that can record any exception and error that happen in a web part (like serilog on .NET). I'm following a guide but there is something ...
supnep's user avatar
  • 1
1 vote
0 answers
142 views

Trouble using PnPJS for SharePoint Term Store in SPFx

I'm developing a SharePoint Framework (SPFx) application and am trying to interact with the SharePoint Term Store using the Patterns and Practices JavaScript Core Library (PnPJS). I'm using a version ...
Mohammed El Saka's user avatar
1 vote
1 answer
225 views

SPFx extension is not loading term store properties

I have extension which uses the term store as navigation and on the other hand, I have dropdown list where it has the normal text (SiteA, SiteB, SiteC) with different SP site links on it (href). So, ...
striker92's user avatar
  • 113
1 vote
1 answer
479 views

Spfx extension Clear cache or hard refresh

I have four different extensions with different languages with texts on it, I use dropdown on top placeholder to switch between different sites. However, when I switch from English to Polish I still ...
striker92's user avatar
  • 113
1 vote
2 answers
100 views

How to disable a PeoplePicker Field in SPFx?

I have a PeoplePicker Field and a Dropdown with imported Items from a SharePoint List. The default status of PeoplePicker is disabled = {false}, so it is "not visible". I select an item in ...
LeberkäseWhatsappgruppe's user avatar
0 votes
2 answers
975 views

DefaultButton onClick action aborted without any error message

I'm working on a SharePoint Webpart and my DefaultButton has brocken. I load items to an office-ui-fabric Dropdown from a SharePoint List. It's working fine, I get the value of the selected options, ...
LeberkäseWhatsappgruppe's user avatar
0 votes
1 answer
42 views

SPFx: routing "history" does not exist on type 'Requireble<object>'

I making routing in my SPFx, trying to change url parametrs. import * as PropTypes from 'prop-types'; private EventListners(): void { const btnSearch = this.domElement.querySelector("#...
Ann's user avatar
  • 51
0 votes
2 answers
13k views

How to deal with lint warning "Unexpected any. Specify a different type."

How should I go about avoiding the use of "any" in my state interfaces, such as export interface ITestState{ listItems : any // this triggers a lint warning } when it's not exactly known ...
JJD's user avatar
  • 493
0 votes
1 answer
1k views

spfx-controls-react Dynamic form fieldOverrides

I am having trouble passing fieldOverrides parameter for DynamicForm. Currently i am trying <DynamicForm context={context} listId={listId} fieldOverrides = {"...
Amit Kumar's user avatar
0 votes
1 answer
38 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() ...
Pete Whelan's user avatar
0 votes
1 answer
955 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 ...
Pete Whelan's user avatar
1 vote
0 answers
173 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 ...
OLGJ's user avatar
  • 123
1 vote
1 answer
1k 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 ...
OLGJ's user avatar
  • 123
0 votes
1 answer
273 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 ...
Papageno's user avatar
  • 343
0 votes
1 answer
418 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,...
Roberto Hajj's user avatar
0 votes
1 answer
863 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 ===...
John John's user avatar
0 votes
1 answer
853 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) => { ...
abhishek23 Negi's user avatar
0 votes
1 answer
2k 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 ...
John John's user avatar
0 votes
1 answer
474 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 ...
Suresh C's user avatar
0 votes
1 answer
56 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 ...
Ricardo Silva's user avatar
1 vote
0 answers
686 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 '...
Aslan's user avatar
  • 532
0 votes
1 answer
2k 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 ...
John John's user avatar
0 votes
2 answers
1k 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(...
abhishek23 Negi's user avatar
0 votes
1 answer
130 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][&...
AnB's user avatar
  • 37
0 votes
1 answer
38 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}...
Martina Sofia Ojeda's user avatar
0 votes
2 answers
650 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/...
abhishek23 Negi's user avatar
0 votes
1 answer
273 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 ...
abhishek23 Negi's user avatar
1 vote
1 answer
386 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 {...
kelank's user avatar
  • 97
2 votes
2 answers
296 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']; ...
abhishek23 Negi's user avatar
0 votes
2 answers
18k 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 '...
sharepointkonsult's user avatar
0 votes
2 answers
89 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 ...
sharepointkonsult's user avatar
0 votes
1 answer
144 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
abhishek23 Negi's user avatar
0 votes
0 answers
248 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: ...
abhishek23 Negi's user avatar
0 votes
1 answer
1k 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 ...
Vivek's user avatar
  • 37
0 votes
2 answers
729 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 ...
SPBogdan's user avatar
0 votes
1 answer
42 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 ...
Lore.A's user avatar
  • 11
0 votes
1 answer
733 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/...
Pete Whelan's user avatar
0 votes
2 answers
428 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 ...
Mark L's user avatar
  • 4,065
0 votes
1 answer
207 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 ...
Denis Molodtsov's user avatar