Hot answers tagged

8

It depends heavily on your requirements and on the app type you are going to build (web application or just console daemon, azure function, etc.). Does it require user context or not? Here are the options available: Create Azure AD application, give required permissions to SharePoint and use node-adal library for OAuth (authorization code flow, client ...


6

This is the issue related to yeoman. You can fix this issue by downgrading it from 4.0.0 to 3.1.1 npm install yo@3.1.1 -g This combination does not work @microsoft/generator-sharepoint@1.11.0 gulp@4.0.2 npm@6.14.11 yo@4.0.0 This combination works @microsoft/generator-sharepoint@1.11.0 gulp@4.0.2 npm@6.14.11 yo@3.1.1 Similar question was asked here.


5

I have created a solution. I'm not 100% sure if it is a good one, but it works. It only works on SharePoint Online. The demo code below is run using tick directly on a SharePoint site in Chrome. I also don't know what to pass as ChangeToken, but I figured I want Item, Update and Add. Code below requires sp-pnp-js version 3.0.4. Getting the newest change ...


3

Looks like it's impossible to add a web part to the page over REST at this moment. What a shame. The AddWebPart_Client method of the SPLimitedWebPartManager class is the client-side equivalent of the AddWebPart method. Unfortunately, this method is decorated with a ClientCallableMethod attribute having ClientLibraryTargets=ClientLibraryTargets....


3

You can also try sp-request With sp-request you can easily send REST queires: var spr = require('sp-request').create(credentialOptions); spr.get('http://sp2013dev/sites/dev/_api/web/lists/GetByTitle(\'TestList\')') .then(function (response) { console.log('List Id: ' + response.body.d.Id); }) .catch(function(err){ console.log('Ohhh, ...


3

Ok i found the problem... First: The API calls were both correct. The fact is that I am developing with Nodejs and I realized that the request module automatically converts the result to utf8 as the documentation says: encoding - Encoding to be used on setEncoding of response data. If null, the body is returned as a Buffer. Anything else (including the ...


2

Consider using sp-request module for that purpose. Your code will be: var sprequest = require('sp-request'); var creds = { username: 'johndoe@contoso.onmicrosoft.com', password: 'mycoolpass' }; var request = sprequest.create(creds); request.requestDigest('https://mysharepoint.com/sites/mysite') .then(function (digest) { return request....


2

When you run the command gulp serve it builds the solution and copy the assets and starts the service. If you see your command prompt there is API server running in the background to serve the web parts to O365 workbench from the localhost. If you stop the server by clicking CTRL + C you lost the web parts from the WebParts toolbox list on the O365 page. ...


2

Edit - Without Iframe option. You can also use directline to customize web chat UI. For react below is sample from MS documentation(link) To install the production build from NPM, run 'npm install botframework-webchat' import { DirectLine } from 'botframework-directlinejs'; import React from 'react'; import ReactWebChat from 'botframework-webchat'; export ...


2

For SharePoint Online and username + password authentication, you can try using my sp-request module. It's for SharePoint primarily, however, works for MS Project as well.


2

There are some libraries available for such a task. For example consider sppull. With sppull you can easily download file with just a few lines of code: var sppull = require("sppull").sppull; var context = { siteUrl: "http://contoso.sharepoint.com/subsite", creds: { username: "user@contoso.com", password: "_Password_" } }; var options = { ...


2

With SPFx solutions, none of the npm packages are deployed to SharePoint, so you can ignore these audit warnings. If you had a custom solution that did deploy the npm packages themselves, yes you'd need to address it. Don't be alarmed by vulnerabilities after running NPM Install


2

You can add new web part on your existing solution by executing below command in the existing solution directory. yo @microsoft/sharepoint https://blog.mastykarz.nl/add-second-web-part-sharepoint-framework-project/


1

I am assuming that you have installed only one version of nodejs at a time. For SPFx generator SharePoint online you will require v10.24.0 of nodejs. Open command prompt and run following command in CMD to check global version of package npm list -g --depth=0 Ideally it should display following following version +-- @microsoft/generator-sharepoint@1.11.0 +--...


1

It's been happening to me as well. As a workaround, I've modified the spfx bundling process to tell it explicitly where to look for react and react-dom by defining them like other externals (after removing them from preexisting externals list). I haven't tested this solution in workbench though (only on live site debugging, since I'm working on listview ...


1

Consider sp-request module. It does all authentication for you. You can use REST API without thinking about the auth: import * as sprequest from 'sp-request'; let spr = sprequest.create(credentialOptions); spr.get('http://sp2013dev/sites/dev/_api/web/lists/GetByTitle(\'TestList\')') .then(response => { console.log('List Id: ' + response.body.d.Id);...


1

Please refer the official document here: Set up your SharePoint Framework development environment Use Node.js v10.x. Install Yeoman and gulp: npm install -g yo gulp Install Yeoman SharePoint generator: npm install -g @microsoft/generator-sharepoint


1

The documentation of PnPJS shows how to set a proxy URL when performing the setup: https://pnp.github.io/pnpjs/nodejs/docs/proxy/ import { SPFetchClient, SPOAuthEnv, setProxyUrl } from "@pnp/nodejs"; sp.setup({ sp: { fetchClientFactory: () => { // call the set proxy url function and it will be used for all requests regardless of ...


1

It looks like it is bug in visual studio code or may be in yomean or may be in typescript because when I run gulp serve it compile web part and resolve the issue by it self. Hope this can help someone else.


1

Install SharePoint Feature Pack 2 from here: security update for SharePoint Server 2016: September 12, 2017 This update allows SPFX Development in SharePoint 2016 on-premise.


1

Yes. The points you mentioned are few advantages out of all. You can read the Key Features. The Node.Js is a cross-platform JavaScript runtime engine which plays the same role as .Net CLR in the .Net Applications. It is not going to interact with SharePoint server. The first release of the SharePoint Framework will contain support for client-side web parts....


1

Please go through this article. This article discuss some advantages and disadvantages about SPFx which can help you. Overall the article discuss following advantage of SPFx: Complete Client Side. Fast, Lightweight and Responsive. Run on User Context Remote Development


1

When using this gulp task, is it actually uploading files? If yes, can you do a quick change in one of the source files to check if it can fix it? In the node_modules folder, look for a folder named gulp-spsync and open the index.js file. In that file there should be three lines like this: cb(null,file). Change these to: cb(). Save the file, and run the ...


1

This doesn't sound SharePoint specific, however that said I think you should consider this problem in the same category as something like session state in a similar configuration. You need to store that data somewhere that all frontends running your app can get to. That could be a DB for example. OR a shared cache like Redis. You can then use something ...


1

There is a specific library for SharePoint. You can download it from https://github.com/lstak/node-sharepoint Then use it as contacts.add({LastName: 'Picolet', FirstName: 'Emma'}, function (err, data) { // data contains the new item returned from server. // data.Id will be the server assigned Id. })


1

Are you using the correct format? A metadata field value is organized like this: "cachelistid";#"displayname"|"guid" If this caching list id (forgot the exact name of this) is not available or if you simply don't want to bother caching, just use -1. Values are saved in a hidden list on the SharePoint site. In other words, you have to insert a value ...


1

For those who are still looking for the answer - consider sp-request nodejs module. It allows you to perform OAuth client credentials grant (in different terminilogy it's also called addin-only permissions or application only permissions). For low-trust apps it uses AzureACS in order to obtain an access token, for high-trust apps (server 2 server ...


1

This was the exact problem I was facing. This is an old question but my answer might be helpful to someone else coming here. It is possible to do OAuth from Node.js or any other web-app. Here are the step by step instructions in my blog - https://medium.com/@yash_agarwal2/performing-oauth-and-rest-calls-with-sharepoint-online-without-creating-an-add-in-...


Only top voted, non community-wiki answers of a minimum length are eligible