How to compare 2 libraries?
-
01-10-2020 - |
Question
I have a situation with employee records. I have few libraries with active employees records. and I have 2 libraries that contain terminated employees records. The idea is when someone is terminated then move her/his records from active library to terminated library.
The HR users copied records from Active to Terminated libraries instead of MOVING the items. Now I need to find out employees in both libraries. How do I do this?
Solution
You can use
- PowerShell script to iterate the library items and compare
- You can export both libraries into Excel, then merge the two files, the sort it to find duplicates.
OTHER TIPS
You can try the below powershell:
$mSite = Get-SPweb "http://sharepointed.com/site/taco"
$aList = $mSite.lists["A"]
$bList = $mSite.lists["B"]
$arrA = @()
$arrB = @()
foreach($iA in $aList.Items)
{
$arrA += $iA["Title"]
}
foreach($iB in $bList.Items)
{
$arrB += $iB["Title"]
}
$c = Compare-Object -ReferenceObject $arrA -DifferenceObject $arrB -PassThru
Write-Host $c
Source: http://www.sharepointed.com/2012/10/02/use-powershell-to-compare-two-sharepoint-lists/
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange