I want do some analysis of a rather large Site Collection in SharePoint Online.

I want to figure out what has value and could be considered for migration vs old data that is not used.

I have been asked for last accessed date and last modified date. This is because people may still be looking at data even if its old and has not been modified in a while.

Ideally I would like to report against every object in every site of the site collection.

Could anyone share a powershell script or other method they are using for this?

3 Answers 3


I would recommend ShareGate, as it's site reporting features are pretty good.

As for last accessed date, you may need to delve in to the SharePoint audit logs to find this data.

Update: You can also use Microsoft Purview to inspect audit logs.

  • I am already using ShareGate and it does not support last accessed date OOTB. The O365 Audit Log is not practical for a large Site Collection and it only supports the last 6months. Jun 10, 2022 at 16:49
  • I'm not sure what you mean, the Audit Log is designed to deal with millions of records. I have updated my answer to include Microsoft Purview where you can manage retention policies e.g. the 6 month limit Jun 10, 2022 at 16:56

This article might help too:

SPO Site LastContentModifiedDate vs LastItemModifiedDate vs LastItemUserModifiedDate vs Graph LastModifiedDateTime


You can use below API to fetch the activity details of the file in array and get the first entry:


Please let me know how you have handled for large datasets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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