Мне нужно распечатать отчет, который показывает, кто редактировал документы, ниже приведен код, который я использую. Выходные результаты для:
'Modified by Option 1' is Microsoft.SharePoint.Client.User
'Modified by Option 2' is Microsoft.SharePoint.Client.FieldUserValue
What am I missing?
#Get the web & Library
$Web=$Ctx.Web
$Ctx.Load($Web)
$List = $Web.Lists.GetByTitle($LibraryName)
$Ctx.ExecuteQuery()
#Get All Files of from the document library - Excluding Folders
$Query = New-Object Microsoft.SharePoint.Client.CamlQuery
$Query.ViewXml = "<View Scope='RecursiveAll'><Query><Where><Eq><FieldRef Name='FSObjType' /><Value Type='Integer'>0</Value></Eq></Where><OrderBy><FieldRef Name='ID' /></OrderBy></Query></View>"
$ListItems=$List.GetItems($Query)
$Ctx.Load($ListItems)
$Ctx.ExecuteQuery()
$VersionHistoryData = @()
#Iterate throgh each version of file
Foreach ($Item in $ListItems)
{
$File = $Web.GetFileByServerRelativeUrl($Item["FileRef"])
$Ctx.Load($File)
$Ctx.Load($File.ListItemAllFields)
$Ctx.Load($File.Versions)
$Ctx.ExecuteQuery()
#Send Data to object array
$VersionHistoryData += New-Object PSObject -Property @{
'daysSinceModified' =$daysSinceModified
'File Name' = $File.Name
'URL' = $FileURL
'Modified by Option 1' = $File.ModifiedBy
'Modified by Option 2' = $Item["Editor"]
}
}
}
}