by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Anuj Kumar Pal
    @Anujkmrpal
    @koltyakov thanks
    shoaib0077
    @shoaib0077
    Hello, I would need to fill up a javascript object with all the site pages and their author information from sharepoint using pnpjs and then will set state in componentDidMount. I would need to use a for statement to get the author for each page in result and this is where i am not sure how to use promise and how to set state. Any guidance would be highly appreciated. I am using react. Thanks
    This is the kind of data i am trying to retrieve, the issue is if i use promise to get authors in for loop, state gets set with limited items and gets stuck until page is re-render.
    image.png
    Andrew Koltyakov
    @koltyakov

    You can easily get all that information in one call. Site Pages is a document library, similar as a list, all items can be requested with the metadata, author is one of the columns.

    E.g.

    const list = sp.web.lists.getByTitle('Site Pages');
    list.items
      .select('*,Author/Title,OData__AuthorByline/Title')
      .expand('OData__AuthorByline,Author')
      .get()
      .then(console.log);
    shoaib0077
    @shoaib0077
    @koltyakov Thank you very much, however, i am trying to retrieve Email by expanding Author/Email but its not working. As i would need email to get the user profile pic from user photo page "/_layouts/15/UserPhoto.aspx?size=s&accountname=
    Andrew Koltyakov
    @koltyakov
    @shoaib0077
    You can also get EMail as well, the common mistake is the casing, should be EMail but not Email
    image.png
    shoaib0077
    @shoaib0077
    That's Awesome EMail worked :) Thanks so much for saving me lots of calls.
    Andrew Koltyakov
    @koltyakov
    The greener the planet and MS spends less electricity =)
    Anuj Kumar Pal
    @Anujkmrpal
    @koltyakov Can we push files in sharepoint with sppull
    Anuj Kumar Pal
    @Anujkmrpal
    @s-KaiNet I am using spsave to upload file to sharepoint, file is uploaded but I also want to insert value in other columns
    image.png
    In above example i want to enter data in policyNumber but it is not inserted
    And can you please describe use of keys in filesMetaData
    above-average-developer
    @above-average-developer

    Good day, @s-KaiNet . I have been using sp-request to scrape pages within a site collections on SP2013 for a couple years now. I now need to update my node code to work with SPO, app-only permissions. I'm able to authenticate to SPO without issue however, the same technique to grab the HTML of a SP page no longer works.

    With SP2013, I could simply pass the full URL and the response would return the HTML. When I try the same with SPO I get an authentication error. Here's the current code:

    /*jshint esversion: 6 */
    
    const sprequest = require('sp-request');
    
    let spr = sprequest.create({
      siteUrl: 'https://tenant.org/sites/dev',
      clientId: '1beab0a4-a10d-4a6b-xxxx-b4c247faa95f',
      clientSecret: 'SZvu9Gmbxxxx9fHGeZ+KC9QBxxxx1ApHAlLeNAermug='
    });
    
    const url = encodeURI('https://tenant.org/sites/dev');
    
    function peek(url) {
      url = url.toLowerCase();
      return new Promise(function () {
        spr(url)
          .then(function (response) {
    
            console.log(response.body);
          })
          .catch(function (err) {
            console.log('Something went wrong.... ' + err);
          });
      });
    }
    
    peek(url);
    Sergei Sergeev
    @s-KaiNet
    @above-average-developer that's because spo uses different authentication. You could try username/password instead of app-only
    above-average-developer
    @above-average-developer
    I can authenticate with no issue and I can retrieve lists and libraries. I just can get the page HTML for scraping like I could in SP2013.
    • can't
    Andrew Koltyakov
    @koltyakov
    Add-in Only auth is limited with API consumption only, you can't use it for requesting a page content.
    above-average-developer
    @above-average-developer
    @koltyakov , that's exactly what I needed to know. Thank you!
    shoaib0077
    @shoaib0077
    Hello, I am having some issue with types i think. I am trying to set the style of an html element through reactdom and i know it should work but givng me the following error
    image.png
    Alex Lee
    @alexleely
    Hi hi, I am current using SPPP to create a react app on SharePoint 2016 on premise. The SharePoint site is on HTTPS. Can I check is it possible that the react app can be served thru HTTP2 protocol or it is a SharePoint Limitation due to Windows authentication that on application on Sharepoint is defintiely on HTTP1.1? Sorry if my question may be incorrect. Thanks in advance .
    Andrew Koltyakov
    @koltyakov
    Hi @alexleely, can you elaborate? Do you need to start local workbench on HTTPS? Yes, this is possible, internally local server is started using webpack dev server it can be provided with http2, https certs configuration (https://webpack.js.org/configuration/dev-server/#devserverhttp2) (will copy a setup semple below). Regarding HTTP2 do you really reference to SPDY? SPDY won't work in SP with NTLM or Kerberos authentications.
    image.png
    Alex Lee
    @alexleely
    Hi @koltyakov , thank you do much for the guidance and sorry for so unclear in my questions as I am new to node, react, SPPP.
    Alex Lee
    @alexleely
    1. Yes, would like to run Local WorkBench on HTTPS. I am trying it out now but hit a bit of problem and trying to figure out
    Alex Lee
    @alexleely
    1. I was just aware of HTTP2 and HTTP 1/1. If my SharePoint sites is in HTTPS and my app is deployed in the sites, does it automatically serve as HTTP2 or it will be HTTP 1/1? Based on testing, it i still serving as HTTP 1/1 in chrome browser but in Edge some pages are in HTTP 2 and some are in HTTP 1/1.
    1. The reason for check ing on HTTP2 is that we hope to further improve the performance for pages. It has improved since we use your SPPP as previously was SSOM. But was thinking if HTTP2 will be even faster.
    Alex Lee
    @alexleely
    image.png
    I am able to run local workbench in https
    thanks so much
    Alex Lee
    @alexleely
    Hi @koltyakov, do you have any example on SPPP deployment thru Azure Dev Ops or I can follow the same as the following for SPFX : https://www.rbaconsulting.com/blog/tutorial-implementing-a-ci-cd-pipeline-for-your-spfx-projects-in-azure-devops/?
    Andrew Koltyakov
    @koltyakov
    Hi @alexleely, how about npm run build then npm run publish with environment variable for authentication (https://github.com/koltyakov/node-sp-auth-config#environment-variables). Please leave an issue with the request to add Azure DevOps sample in the repository I’ll add a generic sample, but it’s really just binding env vars for auth (making sure prod mode is on) and the ordinary frontend project pipeline actions specifics.
    Alex Lee
    @alexleely
    Hi @koltyakov , thank you so much!
    Andrew Koltyakov
    @koltyakov
    Alex Lee
    @alexleely
    Hi @koltyakov , thank you once again for coming up with the sample! It is great!
    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
    image.png
    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'.

    image.png

    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
    image.png