s-KaiNet / spsave

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

Error uploading files when no checkin set #58

Closed kymberlyhaugen closed 4 years ago

kymberlyhaugen commented 4 years ago

When I try to omit the optional checkin boolean and upload a new version of files that already exist, I get a "must be checked out" error.

Example: I have a folder with a test.html file in it. The folder requires check in and check out. I want to upload a new version of this test.html file but I don't want to check it in after uploading.

I can omit the checkin boolean and upload files if the files are new or if the files are already checked out, but not if they exist already and aren't checked out.

With the checkin option being optional and the options to check in major or minor versions, I thought that I would also be able to replace an existing file and not check it in.

Am I doing this incorrectly?

    var spsave = require("spsave").spsave;
    spsave({
        siteUrl: 'my url',
    }, null, {
        glob: 'dist/css/**',
        folder: 'Style%20Library/branding/',
        base: 'dist'
    })
    .then(function(){
        console.log('saved');
    })
    .catch(function(err){
        console.log(err);
    });
s-KaiNet commented 4 years ago

If your library requires checkin\checkout then you don't have other choices rather than using check-in spsave option.

kymberlyhaugen commented 4 years ago

Ok so the checkin option is needed to check the files out before they are uploaded (and check them back in). Am I understanding that correctly?

I think it's a fairly common scenario that you would want to upload a newer version of a file but not want to check it in immediately because you're not done editing it yet and don't want the version to be seen by people without contribute permissions.

Would it be possible to add an option to checkinType option to skip the check in? Perhaps a 3 skips the check in? Then if I run the upload again, it will see that it's already checked out and will skip that step and re-upload?

s-KaiNet commented 4 years ago

Ok so the checkin option is needed to check the files out before they are uploaded (and check them back in). Am I understanding that correctly?

Right

I think it's a fairly common scenario that you would want to upload a newer version of a file but not want to check it in immediately because you're not done editing it yet and don't want the version to be seen by people without contribute permissions.

That makes sense, I've published a newer version 3.1.6 with this feature. Now you can provide 3 as nocheckin. That way your file will remain checked-out. Please try it and say if it works for you.

Thank you for the suggestion!

kymberlyhaugen commented 4 years ago

It's working perfectly! I'm able to upload new versions without the files being checked back in. The only minor thing is the message says that it is checked in, even though it's really not successfully uploaded to 'my url' and checked in. Checkin type: nocheckin

Thank you so much for the update. I really love this tool and it's made my dev life a bit easier.

s-KaiNet commented 4 years ago

Thank you! Glad it works for you. I'm closing the issue.