2

I am archiving site collections if they are not in use anymore therefore I have a small linq query to get List's Last Item Modified Date.

rootWeb.Lists.Cast<SPList>().Where(l => !l.Hidden).Select(l => l.LastItemModifiedDate).Max()

It was working properly before Cumulative Update (KB4018302). After Cumulative Update (KB4018302), there are changes on Form Templates, Documents Libraries which I couldn't see.

I checked these libraries on SPD to see is there any new file has been added but there is no new file.

I checked our deployment scripts to be ensure I didn't broke anything many times but everything is fine.

I am not sure is there any timer job which effects these libraries ?

Does CU has effect on SPList.LastContentModifiedDate property ?

Do you have any suggestion to get proper last modified date of site collections? (Except SPWeb.LastItemModifiedDate,SPSite.LastContentModifiedDate)

Edit : I tried this powershell implementation according to one of responses, The dates are still not proper.

foreach ($wa in get-spwebapplication | where{ $_.Displayname -like "*Portal*"})
{
    foreach ($site in $wa.Sites)
    {
        write-host $web

        foreach ($web in $site.RootWeb)
        {
           $changeQuery = New-Object Microsoft.SharePoint.SPChangeQuery($false, $false);
           $changeQuery.SystemUpdate = $false;
           $changeQuery.List = $true;
           $changeQuery.Item = $true;
           $changeQuery.Folder = $true;
           $changeQuery.Add = $true;
           $changeQuery.Delete = $true;
           $changeQuery.Update = $true;

           $spChangeCollection = $web.GetChanges($changeQuery);

           $LastItemModifiedDates = New-Object System.Collections.ArrayList

           foreach ($change in $spChangeCollection)
           {
                $LastItemModifiedDates.Add($change.Time);
           }

           write-host ($LastItemModifiedDates | Measure -Max).Maximum

        }

    } 
}
2

For valid "last modified" of SPWeb of SPSite or SPList content, I usually use the GetChanges methods, as they are supported on on-prem and Online.

If CU modified content it is hard to say except that I believe it doesn't really modify content, but LastContentModifiedDate probably gets data from somewhere deeper, and CU's definitely touch lot of objects in DB, so I'm not surprised it would have been updated after CU.

Reference for SPSite.GetChanges here, other you can find from respective SPSite and SPList objects: https://docs.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.spsite.getchanges?view=sharepoint-server.

  • Thank you for your contribution. I will write down a powershell script for this implementation to share with people. – Onur CAN Aug 27 '18 at 8:22
  • Jussi, I tried your suggestion,the dates are still not proper. Could you please take a look whether the implementation is fine? If you have any suggestions, It will be helpful a lot. – Onur CAN Aug 27 '18 at 11:31
  • Just to confirm, how are the dates wrong? – Jussi Palo Aug 27 '18 at 14:10
  • For example, I am adding a news feed item or a document, they workspace last modified date according to script which I wrote is wrong. – Onur CAN Aug 28 '18 at 6:13
  • Stupid question, apologies, but have you verified it's not Regional setting that has changed, so the dates and times you get in UTC do are completely off? How many hours/days? – Jussi Palo Aug 28 '18 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.