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.

60 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
1answer
220 views

SharePoint 2013 : Calling function in javascript file from Ribbon button

I am trying to call a function in an external javascript file from SharePoint 2013 ribbon button. I have a Typescript file and i am using Webpack to transcompile it to javascript. When i try to call ...
2
votes
0answers
1k views

@types/react and @types/prop-types errors when building with gulp build or gulp serve

For my team's project, some of us are hitting a type issue when building. We're using version 1.7.0 of all the @microsoft/sp- packages. tslint version: 5.9.1 typescript version: 2.4.2 Build tools ...
2
votes
0answers
33 views

Working with npm packages in SharePoint hosted app

I am starting to work on a SP 2013 hosted app. I am planning to use typescript and have setup my project with Typescript configurations enabled. I have created a SP module called "dist" and all ...
2
votes
0answers
38 views

permissionKind returns void in React

I have a search function that returns all list items including their parent link based on their content type, tenant-wide. Every list item comes from a specific subsite and I want to split the ...
2
votes
0answers
84 views

I need to get all properties of taxonomy termstrore. which I already get are “Label”,“WSSId”,“TermGuid” but I need to get Other labels as well

Is there any solution to get other properties for taxonomy termstore. As I remember, I usually used "include" to get all properties which I mentioned in JSOM. But now I need to work by using ...
2
votes
0answers
106 views

TypeScript and SharePoint Framework question - although works but does it represent correct design?

Thanks for reading my question. I am just beginning to learn TypeScript and from my understanding so far I have created the follow code to retrieve list items from a list. The code works but I am not ...
2
votes
1answer
243 views

Mapping json out to typescript in spfx

I have the following json output : "ParentTerm":{ "Name":"Accounting", "ID":"e8c3c601-d3e0-4499-b0ad-3b520924af15", "Root":true, "ChildTerm":[ { "...
2
votes
0answers
69 views

Redirect to DisplayForm after Item has been saved using CSR and TypeScript

I have a problem that's really bugging me. I am trying to redirect the user to the DisplayForm once he has created a new ListItem in NewForm. I have two problems: I don't know how to get the ID of ...
1
vote
1answer
27 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 ...
1
vote
0answers
167 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
154 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 ...
1
vote
0answers
88 views

(Problem)SPFx rendering items from RSS after selecting number of items you want to display with slider

I am currently building an RSS webpart in SPFx using React as a framework. Now I am in the stage that I want the user to be able to select how many news items he/she want to see with a slider (taken ...
1
vote
0answers
203 views

Issue with rendering XML data in SPFx

I am in a project of making a RSS feed in SPFx and using React.js and TypeScript. When I try to retrieve XML data from a news site, the console gives error: Because it complains about CORS, so I ...
1
vote
0answers
27 views

Two search web parts on the same site not working (only in the same page)

I have two search web parts. The are based on each other, that is is that they pretty much does the same thing with some lesser tweaking. The have different product ID and alias. Only the code is ...
1
vote
0answers
211 views

Set current user in Fabric.UI people picker

I'm struggling setting the current user to a people picker control in Office.Fabric.UI const people: (IPersonaProps & { key: string | number })[] = [ { key: 1, imageInitials: 'PV', ...
1
vote
0answers
227 views

Not able to print HTML based on If statement

So I'm trying to print some HTML code depending on the IF statement. but I'm getting "undefined[object Object][object Object][object Object]" public render(): React.ReactElement<ISPWebPartProps&...
1
vote
1answer
356 views

sharepoint framework call async function

Help please, I'm trying to call the function to get the number of comments from the modern page, but I can not correctly display the result in the html code: private async getSitePageComments(id: ...
1
vote
0answers
231 views

How to use jquery.slimscroll in spfx

I want to use slimscroll for a couple of SPFX webparts but having trouble to get things going. I used: npm i jquery-slimscroll npm i @types/jquery.slimscroll next to a couple of other modules (...
1
vote
2answers
221 views

I have upgraded from yeoman 1.3.4 to 1.4.0 and I cannot import mystrings.d.ts

I have a file mystrings.d.ts which contains :- declare interface IReactSearchBoxStrings { PropertyPaneSearchOptions: string; BasicGroupName: string; DefaultSearchResultsPageUrlFieldLabel: ...
1
vote
0answers
145 views

Problem getting typescript class to work with CSR

I am trying to write a TypeScript/React class that will only get instantiated once and is accessible globally. The reason for this is a SharePoint CSR script. I load this script for New/Edit/Display ...
1
vote
2answers
3k views

Import SP.js to typescript (Angular 4) application and use JSOM

I would like to use JSOM for things like creating Caml queries as I have to migrate AngularJS to Angular 4. The app is running in a WebPart. Unfortunately there is no npm package for this. How can I ...
1
vote
1answer
923 views

How to use Office UI Fabric Callout in SPFx WebParts?

I try to use a good pattern to use the Callout, for instance when hovering over a Persona element. Currently I do the following: _clientPersonaElement is a reference to the Element the Callout uses ...
1
vote
1answer
123 views

Object doesn't support property or method '$1Q_0' when using cascading executeQueryAsync

I have a very annoying problem. I get the above error every time I execute below code. It happens at the second executeQueryAsync call. The error callback isn't hit nor did I find anything interesting ...
1
vote
1answer
919 views

SPFX- Lookup column value

I'm retrieving data from a SharePoint list and I'm facing some issues while getting values from lookup column. I was able to successfully pull in the 'Title' column which is a single line of text, but ...
0
votes
0answers
11 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
1answer
15 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
19 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 ...
0
votes
1answer
56 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
20 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
23 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
1answer
28 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
0answers
9 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
14 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
47 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
49 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 ...
0
votes
0answers
14 views

ValidateUpdaeListItem Ajax

I would like to post an ajax call to update a list without updating the version. I was told I can make use of the ValidateUpdateListItem() function. However, when I try using it, I have the error: ...
0
votes
0answers
9 views

Are there typings for the SharePoint and MS Project JSON objects you get from the REST APIs?

I'm working on an SPFx webpart that is going to interact with Project Server, and I'm finding myself setting up things like this: export interface ISelectProjectModalProps { allProjects: any[]; ...
0
votes
0answers
95 views

Jest with SharePoint Framework. SyntaxError: Unexpected token export

I'm trying to do tests on an SPFx project with Jest and Enzyme. I have configured the environment using Andrew Connel's preset to test my solution with React and Typescript. After run 'npm test' I've ...
0
votes
0answers
33 views

File not found error JSOM Sharepoint file uplaod

The code was working perfectly and suddenly this error: "Request failed with error message - File Not Found. Stack Trace - undefined" comes out, can some please help me? onFileSelected(event) { ...
0
votes
0answers
113 views

PnP JS Core : Uncaught (in promise): TypeError: Cannot read property of undefined

I am using PnP js in one of my angular 6 project. I have a function which is defined in the Component, but I am getting this error at run-time when calling from inside the success of PnP SP js: ...
0
votes
0answers
34 views

Sharepoint Online Only, Web Part: Trying to query SQL Server

Let me first say that I'm sorry if this post seems rather vague. I've been trying for weeks now to connect to SQL Server from a custom Web Part i'm creating using Visual Studio Code, TypeScript, Node....
0
votes
0answers
81 views

How to display content of Rich text on webPart

On my SharePoint list, I have a rich text with picture. When I retrieve it on my webPart, the picture doesn't get displayed. I obtained plain text but how can I display picture. i already tried this ...
0
votes
1answer
34 views

How use result of pnp response

I use PnP for getting SharePoint list item. But I don't really know, how use the result of my function. I wish to get items of my SharePoint list using PnP and assign it to my list. My code don't ...
0
votes
1answer
52 views

How show a value when clicking on a table row

I am a beginner with sharepoint and typescript, i have dynamic table, and i want to get value of row when i click on private _renderList(items: ISPList[]): void { let html: string = '<table ...
0
votes
1answer
236 views

Call child component method in parent and visa versa

how can I call a parent components methods from child or visa versa. I'm using reactjs and typescript in spfx webpart. Or should I use helper classes to call methods of another classes from anywhere?...
0
votes
1answer
232 views

Problem with SPFx TypeScript json.value.map(k,i) & query via getuserbyid()

Firstly I'll start with extra question: I'm trying to get data by _api/web/getuserbyid() API call in code. Do You guys know why there is no option for filtering by query for specific data? I mean by: ...
0
votes
0answers
722 views

SPFx TypeScript json response from spHttpClient as array

i want to get data to WebPart from the SharePoint list. but some of the data are eg. PeoplePicker or Multiple line of text and I have result shown as: <div class="...
0
votes
1answer
399 views

SPFx web part: wait for fetching data before rendering header

I already asked this question regarding SPFx extensions. But now I have the same problem I had in that question, but for a SPFx Web part. I use the exact same _getUserInformation() method as ...
0
votes
1answer
749 views

SPLoaderError loadComponentError

I clone the mentioned SharePoint App. Did a npm install. When I run gulp serve, it shows the following error. Please do the needful. [SPLoaderError.loadComponentError]: ***Failed to load component ...
0
votes
1answer
153 views

How to send mass emails with only BCC recipients but not To?

I am trying to send some subscription emails, need all the email addresses in BCC. I tried something like this const requestUrl = `${this.baseUrl}/_api/SP.Utilities.Utility.SendEmail`; const ...