So I am trying to extract version history from a document library in Powershell. I have found the commands/scripts to do this. However I cannot seem to get the comments. From my script I can get modified date ($Ver.Created), user ($Ver.CreatedBy), and version ($Ver.VersionLabel) where $Ver is derived from the foreachloop that loops through Items in a Document Library.
I checked Microsoft's Object members site and found 'Comments', but this has produced nothing. I have tried "Comment", "CheckedInComments", "CheckedInComment".
At this point I am trying to find the script that will extract all member names so I can see which one it is. And yes I do have comments there.
The internet has helped. It helped me make the script I have so far but it looks like all the examples I have found do not talk about the comments at all.
----Update----- I found the member, altering the script to look like this:
$Ver["Check In Comment"]
Instead of this:
$Ver.CheckInComment
I get results but its only the last comment of the latest version. The object gets me different data ("VersionLabel") except for the comments
foreach ($item in $ItemsColl)
{
if ($item.Name -eq $fileName)
{
Write-Output "File Name " $item.Name | Out-File $logFile -append
foreach($Ver in $item.Versions)
{
Write-Output "Version Label" $Ver.VersionLabel " Created " $Ver.Created " Modified by " $Ver.CreatedBy.User.DisplayName | Out-File $logFile -append
Write-Output "Check In Comment " $Ver["Check In Comment"] | Out-File $logFile -append
}
}
}