Sharepoint Online – Check in All Files

I have a user who has a documents library with over 5,000 files. When I try to run script #1, I get the error: “Exception calling “ExecuteQuery” with “0” argument(s): “The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.”

OK so this site wasn’t setup with an ideal configuration, I should just be able to list 1,000 at a time, get all of the checked out files from there, then check them in right?

So I found script #2, which gets all of the items from a list, but doesn’t give me a clear option to only show me items that are checked out. I’ve been struggling all day to try to essentially merge these 2 scripts so I can list 1,000 items at a time, see if they’re checked out, and then once I go through the entire site and have a list of checked out items, check them all in. I’ve tried modifying the query variable with the XML formatting, and even touching it causes the script to not run (I just don’t know the format).

Anyone willing to take a stab at it and share their code? I’m surprised I haven’t found a blog post with this specific question. JFYI I know nothing about sharepoint, and I am trying to learn PowerShell which is why this task fell in my lap.

Script #1: SharePoint Online: PowerShell to Check in All Documents

https://www.sharepointdiary.com/2017/07/sharepoint-online-powershell-to-bulk-check-in-all-documents.html#ixzz5wX2SBYwb

Script #2: PowerShell to Get List Items from Large Lists: https://www.sharepointdiary.com/2016/12/sharepoint-online-get-all-items-from-large-lists-powershell-csom.html

submitted by /u/saucysasori
[link] [comments]

Leave a Reply