Questions tagged [typescript]

The tag has no usage guidance.

0
votes
0answers
22 views

Q: Set Folder's path according to it's title in a list with SPFx

I am creating a folder inside a List with the following code: TypeScript import {sp} from "@pnp/sp"; const shpList = sp.site.rootWeb.lists.getById(ListId); shpList.items.add( { Title: folderName, ...
1
vote
2answers
50 views

Q: Create list item inside folder with SPFx

I am trying to create an item within a folder in a list. Is there an approach with pnpjs that looks like the following? TypeScript import {sp} from "@pnp/sp"; const shpList = sp.site.rootWeb.lists....
0
votes
2answers
38 views

Q: Create visible folder in list with SPFx

Having the following code in an application extension: TypeScript import {sp} from "@pnp/sp"; /*******************************************************************/ const shpList = sp.site.rootWeb....
0
votes
1answer
135 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 ...
1
vote
0answers
73 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 ...
0
votes
1answer
25 views

SPFx React webpart is not displaying all XML items from RSS News Feed

I am currently building an RSS News Feed in SPFx using React as a framework and using an XML link https://feeds.expressen.se/nyheter/ (Swedish news if curious). I can display all items, in this case ...
0
votes
0answers
19 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 ...
0
votes
1answer
11 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
0answers
38 views

Q: Get item URL from a lookup field using pnp/sp javascript library

Set up: Something that may be relevant is that the Sharepoint is in spanish. The script accesses a list to know if the current user has read the mandatory information. This list has a reader field and ...
0
votes
0answers
16 views

Extend Document Information Panel (DIP) with Data from API

The document information panel in SharePoint Online modern view Document Library shows the properties configured in the Site Content Type as well as general sharing or modification information from ...
1
vote
2answers
2k 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 ...
0
votes
1answer
49 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
1answer
31 views

Make web part compatible for IE11

I have a web part that works for every browser but not in IE. It seems to have troubles with "startsWith" which is a function that is not supported in IE11, fair enough. But when I changed the code ...
0
votes
0answers
51 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
2answers
1k views

Add OnClick Event to SPFX Html - No Framework

I have an SPFX Web Part (No Framework) and would like to add an onClick event to my which will call my function swap(). Code: export default class ExpandableIFrameWebPart extends ...
0
votes
1answer
53 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 ...
1
vote
0answers
129 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
1answer
111 views

SPFx Extension: wait for fetching data before rendering header

I am currently developing a SPFx Extension (Application Customizer). I am relatively new to TypeScript (C# developer) and I can't find my error. I have the following onInit method: @override ...
2
votes
1answer
153 views

Using TypeScript global variable with SharePoint functions

Using TypeScript and Angular, I have created a function named getTasks() that I want to fire when a modal is closed. This is the function: getTasks() { this.http.get(`https://example.com/_api/web/...
0
votes
1answer
34 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 ...
0
votes
0answers
83 views

SPfx CKEditor 5 adding additional plugins

hopefully i'm not being too dense here. We have a requirement that a WebPart includes the CKEditor V5. But we need to implement some of the third party plugins that are listed on the CKEditor website. ...
2
votes
2answers
41 views

Where is the documentation for javascript for the pnp libraries?

I am trying to build a SharePoint Add-In and I am struggling because all documentation seems to be in TypeScript. I am sure TS is great but I don't have time to learn it right now. Does MSFT not have ...
1
vote
0answers
380 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 ...
1
vote
1answer
183 views

Get current folder within SharePoint document library with @pnp/sp

I need to get the folder name within a document library, within the ListCommand spfx extension. Is there a way to do that with REST ? can I use @pnp/sp ? I have imported the project with : import { ...
0
votes
1answer
59 views

SPFx - Accessing/appending markup that has been entered in via a property pane text field to webpart

I am currently working on an SPFx webpart. Within my property pane I have: PropertyPaneTextField('CreateNewVerticalNav', { label: 'Create New Vertical Nav', multiline: true, ...
0
votes
1answer
178 views

Spfx dropzone component

I am using the sample react-file upload sample and upon and upload am changing the metadata of the file. The catch is it is working when am testing and when the app is deployed it no more works.The ...
1
vote
1answer
35 views

fetch all the termstores from a current site in sharepoint

public taxonomy() { SP.SOD.registerSod('sp.taxonomy.js',SP.Utilities.Utility.getLayoutsPageUrl('sp.taxonomy.js')); SP.SOD.executeFunc('sp.taxonomy.js','SP.Taxonomy.TaxonomySession',function()...
0
votes
0answers
96 views

Update file metadata in an spfx webpart

i am trying to update a file properties that i have just uploaded. Once the file has been added to the library,i am doing another http request to get the file properties but it is not working.i can't ...
1
vote
0answers
20 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
1answer
128 views

Submit SharePoint 2013 form with custom Save button in Typescript

I've been searching on this issue for a few days now. We use JSLink to add an extra Save button to a New or Edit form. So each form has 3 buttons: Cancel -> cancel the form Save -> (Temporary) Save ...
1
vote
0answers
25 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
25 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
45 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 ...
1
vote
0answers
133 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', ...
0
votes
1answer
44 views

Get List items by specific content type from site and subsites

I'm trying to extract list data from a site (with REST query) and its subsites based on their content type and put everything in a different list. For example from https://mytenant.sharepoint.com/...
2
votes
1answer
430 views

Add Dynamic Property Panes to SPFX

I know this has been asked 1000 times, but i've tried everything in the first 2 pages of google so i've decided to come to you guys for help. I'm trying to create some dynamically added property ...
0
votes
2answers
969 views

Spfx, WebParts and PnP : How to get the current user id?

Good morning every SharePoint fellow ! I know this question has surely already been posted, but i could'n't found a clear answer. Context I am programming a custom WebPart for Sharepoint online with ...
0
votes
1answer
2k views

SPFX list view WebPart with react, list data loaded with PnP js, but not rendering

I have created SPFX webpart with react framework. I successfully get data from SharePoint pnp bu in react data is not loaded. When I resize browser window then data displayed successfully. Please see ...
0
votes
3answers
3k views

_spPageContextInfo.siteServerRelativeUrl is undefined

The _spPageContextInfo.siteServerRelativeUrl is undefined which i'm using to acquire information about the web parts on a page. unfortunately, the value always returns undefined. I tried using the ...
1
vote
1answer
2k views

SharePoint Online full-width page

I am still exploring SharePoint Online creating webparts and deploying through visual studio code using Typescript. I created a HelloWorld webpart and uploaded it on page. I was able to create ...
2
votes
2answers
466 views

Add external libraries in SPFx?

How to add external libraries like material-ui to our Spfx Webpart? I know to add external libraries having their CDN link and types definition like jquery but don't know how to add libraries which ...
0
votes
2answers
164 views

SPFX Angular *ngFor not working with routing

Iam using Angular project from Sahil Malik's blog Use SPFx with Angular and Angular CLI as a startup solution/project.... And i implemented "@angular/router" for routing with some test pages. Just ...
0
votes
1answer
183 views

With PNP JS, How do I handle odata.null return values?

I'm using @pnp in my SPFX project, and I need to get tenant property. The code is as followed: sp.web.getStorageEntity('mytenantproperty1') .then((prop: StorageEntity) => { //How do I ...
0
votes
3answers
342 views

Reactjs, TypeScript & Webpack on SharePoint2013

I know that Reactjs, TypeScript & Webpack can be used on SharePoint Online to create web-parts. But can it be possible to create web-parts for SharePoint 2013 on premise. Please let me know if it ...
2
votes
0answers
74 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 ...
0
votes
1answer
266 views

Why doesn't DOM element behave when setting visibility or display with SPFx/Typescript?

code snippets here produce/render expected data and alert box shows [object HTMLDivElement] the div will not hide; same is true using "visibility", "hidden" <p> <input id="...
1
vote
0answers
145 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
716 views

SharePoint Framework - basic read list items using typescript

I have a question on the following code. All of the code is taken after reading through various get started samples and then tweaked it a bit. I am trying to figure out how it works which is straight ...
2
votes
1answer
165 views

SPFx extension unrelated ApplicationCustomizerContext type tsc error

I have encountered dificulties using the ApplicationCustomizerContext type and the TypesSript 1) I have created a spfx application customizer 2) I have added in the application customizer main ts ...
1
vote
0answers
213 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: ...