Forum Discussion
Luis Duran
Oct 25, 2018Copper Contributor
I cannot get Set-PnPFileCheckedIn to work
Here is the part of the code that does the checkin for files in a folder $folder = "/Documents" $filesInFolder = Get-PnPFolderItem -FolderSiteRelativeUrl $folder -ItemType File foreach($file in $...
Matt Weston
Oct 29, 2018Iron Contributor
Hi Luis Duran I've just tried running your code and for me it works. My code looks like this:
$folder = "/Shared Documents"
$filesinfolder = Get-PnPFolderItem -FolderSiteRelativeUrl $folder
foreach($file in $filesInFolder)
{
$filepath = "$($folder)/$($file.Name)"
Set-PnPFileCheckedIn -Url $filePath -CheckinType MajorCheckIn -Comment "Checked in by Script"
}
I would suggest checking the version of the PnP PowerShell Commands that you're running:
Get-Module
My local version is 3.2.1810.0, so I'd suggest updating your PS modules if you're at an earlier version
Update-Module SharePointPnPPowerShellOnline
I hope that helps, if not please let me know and I'll have another look for you :)