Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    HIrwaniJain
    @HIrwaniJain
    Hi
    Error: File not found with singular glob: D:/hirwani/PForm/SharePoint-Site-Request-Form_28082018/SharePoint-Site-Request-Form/typings/main.d.ts (if this was purposeful, use allowEmpty option)
    at Glob.<anonymous> (D:\hirwani\PForm\SharePoint-Site-Request-Form_28082018\SharePoint-Site-Request-Form\node_modules\gulp\node_modules\glob-stream\readable.js:84:17)
    Can someone help me with this issue ?
    this is coming after gulp build
    Just trying to reopen one of the old project (built 2 years ago by someone else )
    Ricardo Dias
    @slowdata
    Hi, can someone please help me connect to on premise Sharepoint. I'm getting 401 - Undefined and can't figure out whats the problem
    Ricardo Dias
    @slowdata
    Can someone put me in some kind of direction?
    Andrew Koltyakov
    @koltyakov
    Hi Ricardo, I’d suggest providing more details. What’s the version os SharePoint, what auth strategy it uses and what parameters are you providing. https://github.com/koltyakov/node-sp-auth-troubleshoot can be helpful for scoping auth related issues.
    Ricardo Dias
    @slowdata
    Hi Andrew, thkx
    I never work with integrating nothing to Sharepoint.
    I have a node application to extract some files from Sql server and now i'm implementing the functionality to upload them to a List in Sahrepoint
    I using node-sp-auth to authenticate
    Its a on premises Sharepoint (version 2016)
    The authentication with user password return the Authentication token: NTLM <token>
    Ricardo Dias
    @slowdata
    I think as it's suppose to. Then I tried to make another call (trying to get the Sites Lists) and always get 401
    Andrew Koltyakov
    @koltyakov
    How do you send a request to API? Do you use what node-sp-auth returned in the calls?
    Ricardo Dias
    @slowdata
    yes
    The result in the .getAuth looks goo.

    {
    headers: {
    Connection: 'Close',
    Authorization: 'NTLM TlRMTVNTUAADAAAAGAAYAEAAAADqAOoAWAAAAAkACQBCAQAADgAOAEsBAAALAAsAWQEAAAAAAAAAAAAABoKJAs98GvVVaGG2yLYfeWzsfmpI6Uk2XnJ2AkQWr5sblQlSxNsTTxUs/nABAQAAAAAAABBfMSfWDNYBSOlJNl5ydgIAAAAAAgASAFMARQBHAFMATwBDAEkAQQBMAAEAFABTAFIAVgA0ADAAQQBQAFAAMgA4AAQAHgBzAGUAZwBzAG8AYwBpAGEAbAAuAGwAbwBjAGEAbAADADQAUwBSAFYANAAwAEEAUABQADIAOAAuAHMAZQBnAHMAbwBjAGkAYQBsAC4AbABvAGMAYQBsAAUAHgBzAGUAZwBzAG8AYwBpAGEAbAAuAGwAbwBjAGEAbAAHAAgAzTYlJ9YM1gEAAAAAAAAAAHNlZ3NvY2lhbHJpY2FyZG8udi5kaWFzSUlFUzI2Ri0xMTU='
    },
    options: {
    agent: Agent {
    _events: [Object: null prototype],
    _eventsCount: 2,
    _maxListeners: undefined,
    defaultPort: 80,
    protocol: 'http:',
    options: [Object],
    requests: {},
    sockets: {},
    freeSockets: [Object],
    keepAliveMsecs: 1000,
    keepAlive: true,
    maxSockets: Infinity,
    maxFreeSockets: 256,

      [Symbol(kCapture)]: false
    }

    }
    }

    then with gd-sprest a do this:

    .then((data) => {
    console.log(data);

    const info = $REST.Web(url).Lists("Tiago").getInfo();
    info.headers["Authorization"] = data.headers.Authorization;
    
    
    request({
      method: info.method,
      headers: info.headers,
      uri: info.url,
      json: true,
    })
      .then((res) => console.log("»»» ", JSON.parse(res).d))
      .catch((err) => console.log(">>> ", err));

    });

    I'm don't even now it our sharepoint is ready to use the API. And also the correct endpoints
    Andrew Koltyakov
    @koltyakov
    Don’t know what this rest client. Headers is not the only thing needed for a call with NTLM. Please try sp-request if it can fetch anything in your env without auth issues.
    Ricardo Dias
    @slowdata
    The request is -> const request = require("request-promise");
    Andrew Koltyakov
    @koltyakov
    If it could it’s about options binding into the request.
    Ricardo Dias
    @slowdata
    Ho can i test it with sq-request?
    Andrew Koltyakov
    @koltyakov
    By sending any REST request. E.g. getting a web title so you know that it’s not about auth configuration. http(s)://hostname/sites/site/_api/web?$select=Title
    Ricardo Dias
    @slowdata
    Using the browser?
    Andrew Koltyakov
    @koltyakov
    But using a tool which binds required auth to a call. Like sp-request or pnp-auth.
    In Node of course :)
    If to take a look into what sp-request does, it's not only headers https://github.com/s-KaiNet/sp-request/blob/master/src/core/SPRequest.ts#L56
    That's why NTLM request ends up with 401
    Ricardo Dias
    @slowdata
    I'm getting lost.. sorry.
    Ricardo Dias
    @slowdata
    Do you mean somthing like this:
    spauth .getAuth("http://sharedev.seg-social.pt/sites/rpa/_api/web?$select=Title", { username: "user", password: "passowrd", domain: "segsocial", }) .then((res) => console.log(res));
    Ricardo Dias
    @slowdata
    Andrew, the password must be encripted?
    Andrew Koltyakov
    @koltyakov

    @slowdata I'm suggesting trying something as shown in that https://github.com/s-KaiNet/sp-request#get-list-by-title sample.

    spauth .getAuth("http://sharedev.seg-social.pt/sites/rpa/_api/web?$select=Title", { username: "user", password: "passowrd", domain: "segsocial", }) .then((res) => console.log(res));

    That won't gonna work this way.

    the password must be encripted?

    No, it should not be encrypted when passing to node-sp-auth.

    Ricardo Dias
    @slowdata
    Andrew, using you example a get the Id: 2a3242d4-f247-4cfe-a232-87fbcfc87aa1
    So it seems ok
    Now I need your help to understand it
    Should I just use -> sp-request
    Andrew Koltyakov
    @koltyakov
    If a number of requests in your automation is moderate. Yes, why not use what works for you.
    If it's a variety of different API actions and a fluent helper is desired, then PnPjs + pnp-auth (auth bindings for PnPjs with node-sp-auth).
    Ricardo Dias
    @slowdata
    And using sp-request how can I send files to a List?
    Can you please help me?
    Andrew Koltyakov
    @koltyakov
    Google search: "SharePoint REST API uploading files". Just wondering, are you going asking each next portion of questions regarding your task? ;)
    As a hint of the direction - https://github.com/s-KaiNet/spsave/blob/master/src/core/FileSaver.ts#L89 - you can take a look how to upload a file with sp-request.
    Or using PnPjs - https://pnp.github.io/pnpjs/sp/files/#adding-files
    Or using large files and streaming - https://github.com/koltyakov/pnp-upload
    I'd encourage to dive into that samples and try it first.
    Ricardo Dias
    @slowdata
    Andrew, I thank you very match. I'm new with this and struggling a lot to accomplish this.
    Andrew Koltyakov
    @koltyakov
    All of the suggestions are based on node-sp-auth so you can easily use spsave as a black box and bind creds into there if diving to a low level and figuring out how SP REST API works is not an option.
    Ricardo Dias
    @slowdata
    My main task is to upload a list of files for a Sharepoint List.
    I need to accomplish this and if I do understand all... then perfect
    Andrew Koltyakov
    @koltyakov
    Document library, not a list. List is a container for items not documents.
    I'd just use spsave then as a black-box function for a purpose for uploading.