Hi, I’m fairly new to PowerShell. I have a record center in SharePoint that needs some documents checked in. Too many to do manually, so I thought I would do it programmatically. I’ve looked, but haven’t found the right commandlets to tell me how to identify what is a record in SharePoint. Once I identify that record, I need to undeclare it so I can check it back in. That’s it. Is there a script? I went to ChatGPT, but the script that it generated required entering a document ID. I’d rather just have a script iterate through each library (which I am happy to launch per library for greater control) and do what I want it to do.
Any suggestions or help would be greatly appreciated.
Hi Skipper
Welcome to the forum! We don’t provide ready to use scripts but we can assist you with your existing code. I’d search the internet for how to check files in with powershell to get a rough idea of where to start. I’m sure you could incorporate your ChatGPT script as well if needed. Here a few links that may help you get started.
SharePoint Online: PowerShell to List All Files in a Document Library - SharePoint Diary.
2 Likes
I would checkout Microsoft Graph API calls. Microsoft has a Powershell Graph SDK that works pretty well with sharepoint/onedrive. I use it in many of my scripts to read/upload files.
Specifically I think this is what you want:
Powershell Graph SDK command: Invoke-MgCheckinDriveItem
I went to ChatGPT, but the script that it generated required entering a document ID. I’d rather just have a script iterate through each library (which I am happy to launch per library for greater control) and do what I want it to do.
You will always need the document ID but you should be able to get these IDs programmatically via graph.
1 Like