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: