SharePoint Online SPOMod: Set-SPOFileCheckin

SharePoint Online SPOMod: Set-SPOFileCheckin

This article describes a function of a custom SharePoint Online module available for download and installation here.


Checks in a file.


ServerRelativeUrl  Mandatory  String. Relative url of the file, e.g. "/sites/TeamsiteWithLibraries/ListName/folderName/FileName.PNG"
CheckinType  Mandatory  Accepts three values 'MajorCheckIn','MinorCheckIn','OverwriteCheckIn'. You can tab through the values in the Shell.
CheckinComment  Optional  String. Comment from the revisor 


----- EXAMPLE 1 ------
Check in a single file. The example below targets  CaptureYokoGroupCool2.PNG picture located in fold3 folder, in u8 Document Set, inside a UYYU list in TeamsiteWithLibraries site collection.
Set-SPOFileCheckin -ServerRelativeUrl "/sites/TeamsiteWithLibraries/uyyu/u8/fold3/CaptureYokoGroupCool2.PNG" -CheckInType MajorCheckIn -CheckinComment "Commenting"

----- EXAMPLE 2 ------
Check in all files from a specific folder. The example below targets files from folder called fold3, located in a Document Set u8, inside a list UYYU, which is in TeamsiteWithLibraries site collection.
$serverurls=(Get-SPOFolderFiles -ServerRelativeUrl "/sites/teamsitewithlibraries/uyyu/u8/fold3").ServerRelativeUrl
foreach($filref in $serverurls){Write-Host $filref; Set-SPOFileCheckin -ServerRelativeUrl $filref -CheckInType MajorCheckIn}

----- EXAMPLE 3 ------
Check in all files in a list (throws errors for folders and already checked-in files).
$filerefs=(Get-SPOListItems uyyu -Recursive -IncludeAllProperties $true).FileRef
 foreach($filref in $serverurls){Write-Host $filref; Set-SPOFileCheckin -ServerRelativeUrl $filref -CheckInType MajorCheckIn}

See Also

SPOMod Cmdlets and Resources