SharePoint keeps track of changes through the change log. The change log is configured per web application in central administration. Migrator tools like DocAve Migrator make use of this change log to determine which files have been changed during an incremental migration. This change log proofs to be handy when doing migration. Unfortunately i run into a situation where the change log was not sufficient enough. I only could go back for 30 days. Except the last migration was more than 45 days ago.

So i needed something to determine if there were changes during the other 15 days. I wrote a small PowerShell script to identify those changes. The following script identifies all files modified between two dates. For each of the items, the necessary information is stored into a CSV file which can be imported into Excel. The script ignores the workflow related lists and the User Information List.

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

$outputPath = "d:scriptscheckedfiles.csv"

$dateFrom = [datetime]("1/22/2016")
$dateTo = [datetime]("3/5/2016")

$siteURL = "http://somesite"
$site = Get-SPSite($siteURL)

Add-Content -Path $outputPath -Value "WebUrl|ListTitle|ListBaseType|ItemName|ItemUrl|ItemModified"

foreach($web in $site.AllWebs) 
{
  foreach($list in $web.Lists) 
  {

      if ($list.Title -ne "Workflows" -and $list.Title -ne "Workflow History" -and $list.Title -ne "User Information List")
       {
      foreach ($listItem in $list.Items)
       {

          $a=[datetime]($listItem["Modified"])


	   $datefromAsString = Get-Date $dateFrom -format d
	   $dateToAsString = Get-Date $dateTo -format d
           $modifiedAsString=Get-Date $a -format d

           Write-Host "from:" $dateFromAsString " to:" $datetoAsString " item:" $modifiedasString

	  if (($a -gt $dateFrom) -and ($a -le $dateTo))
	   {
	       $text = $web.Url + "|" + $list.Title + "|" + $list.BaseType + "|" + $listItem["Title"] + "|" + $listItem.Url + "|" + $modifiedAsString 

               Add-Content -Path $outputPath -Value $text

               Write-Host "Item found between dates and is added to csv file" 
          }
       }
     }

  }

  $web.Dispose();
}

$site.Dispose();
Previous articleImplement ADAL for cross-platform Xamarin applications
Next articleDocAve Migrator – Execute an incremental migration using “Full migration”
A professional which inspires, motivates and educates businesses on how to leverage emerging technologies using Virtual, Augmented and Mixed Reality in their journey to digital innovation. He has a strong background on SharePoint, Office 365 and Microsoft Azure and is working with machine learning, artificial intelligence and cognitive services. Primarily focused on manufacturing, construction, industry, logistics and maritime/offshore, his goal is helping businesses to achieve more on creating, improving, smartening and shortening of business processes by using services, apps and devices. Furthermore, he engages in speaking, blogging and is organizer of events like the Mixed Reality User Group, Mixed Reality Talk @ VR, SP&C and the Global AI/MR Bootcamp. With more than 20 years of IT Business experience, acting in different roles like solution architect, he believes the future is just starting! Highly experienced in all realities, HoloLens and other devices, User experiences on devices and connecting the world to the cloud will help him to shape that future!

LEAVE A REPLY

Please enter your comment!
Please enter your name here