How can I force check-in of thousands of files in SharePoint?

0
2
Asked By TechieTraveler42 On

I set up a SharePoint Document Center but mistakenly left the 'require check out' option enabled. Because of this, a user uploaded thousands of documents along with nested sub-folders, making them invisible to others. After I disabled the check-out feature, I can no longer delete the original folder structure since the files are still checked out. I created a new folder for the user to upload files, which works fine, but now I need to manage the check-out situation for the original folder. Is there a PowerShell script that can help me check in all these files? I've encountered some scripts referencing 'Connect-PnPOnline,' but my system doesn't recognize this command. Is it outdated? Furthermore, I tried a script without success; it returned to the prompt without performing any check-ins. Any advice would be greatly appreciated!

3 Answers

Answered By PowerShellGuru99 On

You might want to look into DMS-Shuttle. It can handle bulk check-ins and might be worth the investment if you're dealing with a lot of files. Just a thought!

Answered By CodeFixer89 On

I’d suggest using 'Write-Output,' 'Write-Warning,' or 'Write-Error' instead of 'Write-Host' for better output handling. Also, your try/catch might not be picking up all errors unless they're terminating. Try debugging by starting with the first item in your loop to see if you can locate any bugs in your script.

DebuggingExpert11 -

I disagree that 'Write-Host' should be avoided; sometimes it's just about providing quick informational messages rather than output. You might still use 'Write-Host' for displaying what’s happening without needing the output.

Answered By ScriptingSavant21 On

If you run the script in a debugger, like Visual Studio Code or even the PowerShell ISE, you might get better insights on what's going wrong. Make sure the 'Get-PnPListItem' command actually returns files, as that could be a part of the issue. Testing it with a variable before your loop could help too!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.