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

Fetching User's profile thorugh Graph API into webpart in SPFX

How can we fetch a user profile photo through Graph API and display into Web part in SPFX? Here is my function to call Graph API to fetch Specific user's Profile Photo filtering through their Mail ...
0
votes
0answers
6 views

How to store content of redirected page into a popup form

This is my Webpart in Sharepoint workbench Clicking on the Task-name , redirected to the new page with default pop-up Form This is my redirected page with default pop-up form Is there anyway to show ...
0
votes
1answer
38 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
0answers
9 views

Download file from SP in custom web part without <a></a> tag

I have a custom web part it needs to download a file from SharePoint document lib. I was using the tag combined with the file path, but this seems to break SharePoint. Is there another way to do it? ...
0
votes
0answers
9 views

Adding Dynamic value to the table data in sharepoint framework

I am adding dynamic data to the table through graph api call into the webpart except in the Assigned To table heading I want to fetch the value for Assigned To through another graph api call How can i ...
0
votes
2answers
78 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
1answer
14 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][&...
0
votes
0answers
20 views

Fetching Planner Task through Graph API into webpart

public componentDidMount() { this.props.context.msGraphClientFactory.getClient().then((client: MSGraphClient): void => { client .api('me/planner/tasks') .version("v1.0") ....
0
votes
1answer
19 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
2answers
30 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
0answers
9 views

Add query string to url so that it can show the planner task pop up form

we have created webpart in sharepoint SPFX with react framework and fetch data using graph API From this webpart we want to redirect to planner task's popform This is the Planner Task PopUp form I ...
0
votes
1answer
42 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
1answer
53 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 {...
2
votes
2answers
61 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
25 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
728 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
30 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
32 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
22 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
20 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
42 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
68 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
12 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
79 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
109 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
20 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
186 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
23 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
42 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
53 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
78 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
59 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
30 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
2k 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
28 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
832 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
38 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 '...
1
vote
0answers
33 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
0answers
52 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
210 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
68 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
53 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
34 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
117 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
181 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
56 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
68 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
22 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
29 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 ...