## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
shoaib0077
@shoaib0077
Hello Guys, I am filtering from an object array using multi select dropdown of officeuifabric. Following is the example
universalFilter= AllNews.filter((
{ AuthorName}) =>
selectAuthors.includes(AuthorName))
Now when Selected Authors(Multi Dropdown) is null, It doesnt bring any result but i want all items without filtering on Author when selectAuthor is null.
Bruno Naibert
@bruno-naibert
how do I upload a file to the sharepoint without publishing it using spsave? I tried checkin: false but got errors on the console. I would like to upload files and make them visible only to my user
Andrew Koltyakov
@koltyakov
Hi Bruno, did you try changing checkinType? https://github.com/s-KaiNet/spsave#core-options
Bruno Naibert
@bruno-naibert
@koltyakov
I got it, thank you. Greetings from Brazil.
Andrew Koltyakov
@koltyakov
👍
Alex Lee
@alexleely

Hi @koltyakov ,

I am having some issues on the establishing connection

Below is the code I am using

  # Creating private file from multiline variable from matrix
# Encoding secrets in private file
- script: |
touch ./config/private.json && cat <<EOF > ./config/private.json
(private.json) EOF SPAUTH_ENV=production gulp config displayName: 'Establishing connection' The error is showing: << was unexpected at this time. ## [error]Cmd.exe exited with code '255'. I am not sure if it is due to my private.json? Thank you Andrew Koltyakov @koltyakov Cmd.exe, windows runner! That part should be aligned with cmd if you’re really need a windows runner. The scripts in the pipeline sample are in bash. Why to use win when you can use a linux? :D Alex Lee @alexleely Hi Andrew, thank you so much, i will try to see if I can change it to windows cmd. I am actually using my on premise server for the CI/CD as it is in my company network thanks once again Alex Lee @alexleely Hi Andrew, I just understood what you meant that on using linux. I managed to run the pipline but i still hit an while publishing to sharepoint Could it be because my sharepoint server is behind firewall? HassanNawaz285 @HassanNawaz285 Hi @koltyakov i faced problem in my spfx webpart is that i am using the pagination component of Pnp controle is that <Pagination currentPage={3} totalPages={13} onChange={(page) => this._getPage(page)} limiter={3} // Optional - default value 3 hideFirstPageJump // Optional hideLastPageJump // Optional limiterIcon={"Emoji12"} // Optional /> @koltyakov the problem is that when i use static value in total page it works fine but when i used dynamic value its not works fine that when i filter items on base of Props the Component called but it will not update the total pages but when i reload the page then it will change. Andrew Koltyakov @koltyakov That’s great @HassanNawaz285, but how your question is connected to me or relates to this channel? I’m not involved into controls project at all. Please ask a question in a corresponding repo, that would be more effective and correct. :D Rather than bombarding me with DMs on things which I have no direct connection to. shoaib0077 @shoaib0077 @koltyakov Sorry, i told @HassanNawaz285 to ask this question in this group as i got some good recommendations from you in the past. I apologies for bombarding you with DMs. We both are looking to solve this issue with PNP Pagination. I will try to find the right group for that. Sorry to bother you. Have a great day. mctoastus @mctoastus Hey! I just started out using your amazing package. Now im having a problem: I wanted to go through your samples, and it worked fine till i wanted to create a list item. Here is my Code: https://i.imgur.com/bxYWB1g.png I get the following Error: HTTPError: Response code 400 (Bad Request) at EventEmitter.<anonymous> (C:\Users\mathe\source\repos\CryptoChat\node_modules\sp-request\node_modules\got\dist\source\as-promise.js:118:31). Also im really new to nodejs (?and rest?). So if i want for example to read out the number of list items for example. Where can i find the headers i need for that etc? Im happy for every response! Sincerly Matheo Andrew Koltyakov @koltyakov @mctoastus, please try adding Content-Type=application/json header and JSON.stringify the body. KaianFerreira @KaianFerreira Hello. I am working on a project that uploads files to a folder that is on the sharepoint. The only way to login is through a link that I open and enter a password. How do I do this authentication via node-sp-auth? Obe Lahnkara @Oberothton_twitter Greetings all. I've been trying to setup Sharepoint authentication in Node.js, and despite trying several different methods (node-sp-auth, pnpjs) I'm having all kinds of errors. on the node-sp-auth side, I keep getting an 'invalid argument' error from my type2message response, despite using what i think are the correct credentialoptions. PnP isn't working either, 'cannot read property filter of undefined' and honestly I'm not even sure about the nature of this error. if i'm using Sharepoint On-Prem 2013, where I normally log in automatically with AD, what's the proper library and credential options to use to get the form digest for POST requests? Andrew Koltyakov @koltyakov @Oberothton_twitter, you can node-sp-auth for authentication in on-prem, there are no other alternatives in Node.js, at least I don't know about such. The simplest way of consuming the API without caring too much about headers and digest is PnPjs. With node-sp-auth it can authenticate to on-prem as well. pnp-auth simplifies binding auth fetch client to PnPjs. As you experience authentication issues while node-sp-auth supports NTLM&NTLM2, that means that your environment configured with different authentication or auth parameters are provided incorrectly. I'd suggest troubleshooting with this helper repo first. Obe Lahnkara @Oberothton_twitter can pnp not authenticate on-prem on its own? because I've been trying to use it and keep getting some kind of deeply nested json endpoints filter error I don't understand. Meanwhile, I cloned and ran your troubleshooter using the NTLM creds I was before (which should still be the correct domain name, user, password) === Error === Error: Invalid argument at Object.decodeType2Message (C:\Users\XXX\Documents\ReactTesting\node-sp-auth-troubleshoot\node_modules\node-ntlm-client\lib\ntlm.js:62:9) at C:\Users\XXX\Documents\ReactTesting\node-sp-auth-troubleshoot\node_modules\node-sp-auth\lib\src\auth\resolvers\OnpremiseUserCredentials.js:40:35 at processTicksAndRejections (internal/process/task_queues.js:97:5) at async C:\Users\XXX\Documents\ReactTesting\node-sp-auth-troubleshoot\index.js:22:24 Andrew Koltyakov @koltyakov What’s the version of Node.js? The latest node-sp-auth update requires at least 10.19. Are you sure, your environment is NTLM? But not ADFS or something else? Can it be a mixed auth? can pnp not authenticate on-prem on its own? Sure thing, no. Andrew Koltyakov @koltyakov Also, what’s the finger print of username/domain? Should be 1) username: john@contoso.com, domain: omitted; 2) username: contoso\john, domain: omitted, 3) username: john, domain: contoso However, messing up with creds format would end up with incorrect username and password. So it’s something else. Obe Lahnkara @Oberothton_twitter i've been doing username, password, domain it should be NTLM, that's what was used on a C# script i saw used to connect to this SP site @koltyakov and i'm on node 14.4 Obe Lahnkara @Oberothton_twitter ok i got it did some debugging w troubleshooter and established a connection now what? do i just copy the private.uat into my credential Options ? Andrew Koltyakov @koltyakov What was the issue? Obe Lahnkara @Oberothton_twitter incorrect formatting of sharepoint url i'm loading the urls from an external list in a module and noticed i typed them as http instead of https edited that in credentialOptions and now i can query the digest perfectly Andrew Koltyakov @koltyakov Cool, happy coding! Obe Lahnkara @Oberothton_twitter and to you! Obe Lahnkara @Oberothton_twitter how do i delete a list item using sp-request? setting X-HTTP-Method to DELETE and setting url to _api/web/lists/getByTitle('Holiday')/items({ID}) doesnt seem to work i'm getting a 200 response but the item doesn't delete Obe Lahnkara @Oberothton_twitter @koltyakov sorry for ping but ^do you know how to do this? Andrew Koltyakov @koltyakov This works for me: const { AuthConfig } = require('node-sp-auth-config'); const { create } = require('sp-request'); (async () => { const { siteUrl, authOptions } = await new AuthConfig().getContext(); const spr = create(authOptions); const digest = await spr.requestDigest({siteUrl});
const res = await spr.post(${siteUrl}/_api/web/lists/getByTitle('MyList')/items(1), { headers: { 'X-RequestDigest': digest, 'X-HTTP-Method': 'DELETE', 'IF-MATCH': '*' } }); console.log(res.statusCode, res.statusMessage); })().catch(console.warn); Obe Lahnkara @Oberothton_twitter spr.requestDigest(site).then(digest => { console.log(url); const headers = { 'X-RequestDigest': digest, 'X-HTTP-Method': 'DELETE', 'IF-MATCH': '*' }; spr.get(url).then(response => { let deleteUrl = ${site}/_api/web/lists/getByTitle('Holiday')/items(\${response.body.d.results[0].ID});
                    spr.post(deleteUrl, { headers }).then(response => {
console.log(response.statusCode);
})
this doesn't work for me. Strange.
Obe Lahnkara