OK I don't know if the solution is a benefit for spsave, because I am a junior developer and new to sharepoint. But what I have:
export async function getLibraryItems(libraryUrl: string, con: IConnection): Promise<string[]> {
let apiUrl = libraryUrl.endsWith("/") ? libraryUrl + "_api/web/lists" : libraryUrl + "/_api/web/lists";
let reqR = await sharepointGET(apiUrl, con);
let arr: any[] = reqR.d.results;
let result: string[] = [];
for (let i: number = 0, l: number = arr.length; i < l; i++) {
result.push(arr[i].Title);
}
return result;
}
In my case (I don't know if it is for every case), uploading is always to a library. So I will use the method above to check what folders? I have in the library and save the result in a static variable (don't call it every time) | staticVar[libraryUrl] = result;
if the root folder is not in the variable I will do a doublecheck (maybe someone did an update) and in case the folder is not in it I throw an error.
Error: process.binding is not supported
error so I am guessing that package doesn't support process binding with browser. Does anyone know any modern client side library that does the authentication with sharepoint 2013?
I'm trying connect to SharePoint 2013 from Node
import { sp } from "@pnp/sp";
import { SPFetchClient } from "@pnp/nodejs";
sp.setup({
sp: {
fetchClientFactory: () => {
return new SPFetchClient("{site url}", "{client id}", "{client secret}");
},
},
});
sp.web.select("Title", "Description").get().then(w => {
console.log(JSON.stringify(w, null, 4));
});
But i've got 401 Unauthorized
Please help me understand the reason of the error.
Response headers:
Request headers:
So I am a little confused as I have been trying to accomplish this without success for months. Can node-sp-auth actually authenticate with the current users credentials WITHOUT being give the users credentials? The only time I can get node-sp-auth to work is either saving the credentials to the disk or typing them in directly. A working example of the behavior I am trying to achieve is accomplished (in SQL) with the "msnodesqlv8" module (it specifically appears to use Windows ODBC but I could be mistake, which is obviously not an option for SharePoint, I am just using this as an example of the behavior I am trying to get).
Has anyone been able to have node-sp-auth using the current user authentication without storing the credentials? Thanks!