-
Notifications
You must be signed in to change notification settings - Fork 390
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Reporting an Issue
Since PnP.PowerShell v3.1.0, when I attempt to run this command, I get an error message:
Set-PnPFileCheckedIn -Url $item["FileRef"] -CheckInType MajorCheckIn -Comment $CheckinComment -Approve
The error reads:
The file "Request Form.docx" is not checked out.
Expected behavior
If I load PnP.PowerShell v2.12.0, the command works perfectly: The file is checked in, and approved as a major version, with the comment appended.
Actual behavior
When I run it in v3.1.0+ (I tried it up to Nightly build 3.1.122), I receive the error message: The file "Request Form.docx" is not checked out. and when I look at that file in SharePoint, I can see the file is Checked In, but it is a minor version and approval status = Pending.
Steps to reproduce behavior
# Connect to SharePoint
$conn = Connect-PnPOnline -Url $siteUrl -ClientId $clientId -ClientSecret $clientSecret -ReturnConnection
# Import CSV
$csvData = Import-Csv -Path $csvPath
foreach ($row in $csvData) {
$itemId = $row.ID
$newApprovalDateStr = $row.'New Approval Date'
$newApprovalDate = Get-Date $newApprovalDateStr
$item = Get-PnPListItem -List $libraryName -Id $itemId
if ($item -ne $null) {
if ($null -eq $item["CheckoutUser"]) {
Set-PnPFileCheckedOut -Url $item["FileRef"] -Connection $conn
}
Set-PnPListItem -List $libraryName -Identity $itemId -Values @{"ApprovalDate" = $newApprovalDate.ToString("yyyy-MM-ddThh:mm:ssZ")} -Connection $conn
Set-PnPFileCheckedIn -Url $item["FileRef"] -CheckInType MajorCheckIn -Comment $CheckinComment -Approve -Connection $conn
}
}
Disconnect-PnPOnline
What is the version of the Cmdlet module you are running?
v3.1.0+ (I tried it up to Nightly build 3.1.122)
Which operating system/environment are you running PnP PowerShell on?
- Windows
- Linux
- MacOS
- Azure Cloud Shell
- Azure Functions
- Other : please specify
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working