s-KaiNet / spsave

Save files in SharePoint using node.js easily
MIT License
86 stars 22 forks source link

Where is saved file #50

Closed stychu closed 5 years ago

stychu commented 5 years ago

I am testing spsave for automation of uploading files to the SP. I was able to save file but I have no idea where it's now.

[16:34:07] spsave: Creating folder or full folders hierarchy: 'TESTING'
[16:34:08] spsave: test.txt checked out.
[16:34:09] spsave: test.txt successfully uploaded to 'https://.........sharepoint.com/personal/........../TESTING' and checked in. Checkin type: major
saved

Looking through the sahrepoint onedrive webapp interface: files / recent/ shared / recycle bin can't find the created file. Also going on the generated link gives me NOT FOUND

s-KaiNet commented 5 years ago

Could you post your whole code, please? Don't forget to remove all sensitive information.

stychu commented 5 years ago
const { spsave } = require("spsave");

const coreOptions = {
  siteUrl: 'https://.......sharepoint.com/personal/.....',
  notification: true,
  checkin: true,
  checkinType: 1
};
const creds = {
  username: process.env.username,
  password: process.env.password,
  // online: true
};

const fileOptions = {
  folder: 'TESTING',
  fileName: 'test.txt',
  fileContent: 'hello world'
};

spsave(coreOptions, creds, fileOptions)
  .then(function(){
    console.log('saved');
  })
  .catch(function(err){
    console.log(err);
  });
s-KaiNet commented 5 years ago

I guess you're uploading to onedrive. In that case for folder please provide "Documents" value. It will upload a file to the root of your onedrive. "Documents/Testing" will create a subfolder and will upload to that subfolder.

stychu commented 5 years ago

Great!! It's working, thanks!

How I would also upload to the shared folder ??

s-KaiNet commented 5 years ago

You can upload to a shared folder if you know the exact url of a folder. Otherwise I'm not sure how to do that and have never tried.

stychu commented 5 years ago

Great! Will dig it. Thanks for this plugin great work !