s-KaiNet / spsave

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

Cannot read property 'code' of undefined #73

Open AmolM27 opened 3 years ago

AmolM27 commented 3 years ago

Hi,

Below is an code I am trying on a dev machine to put a file on sharepoint. However, I get: '[10:44:26] spsave: TypeError: Cannot read property 'code' of undefined at ...\node_modules\spsave\lib\src\core\FileSaver.js:199:45 at processTicksAndRejections (internal/process/task_queues.js:97:5)'

Any ideas what the issue is?

var coreOptions = { siteUrl: 'https://test.com/Search', notification: true, checkin: true, checkinType: 1 }; var creds = { username: 'admin', password: 'Password', domain: 'dev' };

var fileOptions = {
    folder: 'Documents',
    fileName: 'file.txt',
    fileContent: 'hello world'
};
spsave(coreOptions, creds, fileOptions)
.then(function(){
    console.log('saved');
})
.catch(function(err){
    console.log(err);
});
s-KaiNet commented 3 years ago

Hi, most likely smth wrong with authentication, but honestly it's quite difficult to troubleshoot such issues. Check the site URL is correct, domain and password. Try different options without a domain, like below:

{
  username: 'john.smith@contoso.com',
  password: 'pass'
}