0

I am trying to detect sharepoint sites in Office 365 not visited last 180 days. With this purpose I query sharepoint sites using a microsoft graph api query like this: GET https://graph.microsoft.com/v1.0/sites?search= which returns an JSON object where object['value'] is the first portion of site objects and object['@odata.nextLink'] is the link to the next portion of site objects (as I understand from what I see in the output) When I view site objects which look like this:

 'id': 'mytenant.sharepoint.com,29c17bd8-db42-430d-b5ba-b55d15885790,6302ea22-aa16-4e12-bd50-6e7094fc65cd',
 'lastModifiedDateTime': '0001-01-01T08:00:00Z',
 'name': 'TEST_MODIFIED_DATE',
 'webUrl': 'https://mytenant.sharepoint.com/sites/TEST_MODIFIED_DATE',
 'displayName': 'TEST_MODIFIED_DATE',
 'root': {},
 'siteCollection': {'hostname': 'mytenant.sharepoint.com'}}

in a loop I can see 'lastModifiedDateTime' property which may (or may not) be what I am looking for. Some sites and this one in particular have a strange value of 'lastModifiedDateTime': 'lastModifiedDateTime': '0001-01-01T08:00:00Z'

  1. What does this strange datetime value mean?
  2. Does it mean the last time the site was visited at all? It does not correspond with the value I can see in Sharepoint web interface ('last activity' column, which is now empty for this site)?
Shiva Keshav Varma
  • 3,398
  • 2
  • 9
  • 13
  • Please use the 'id' that you have got from the search query and try to use that site id in the following query. https://graph.microsoft.com/v1.0/sites/{siteid} You can get the right lastModifiedDateTime. Please let me know if you have any queries on this. – Shiva Keshav Varma Sep 02 '20 at 10:17
  • @Shiva-MSFTIdentity, thank you very much! It seems to be what I need. It returns 'lastModifiedDateTime': '2020-09-01T04:44:20Z', which is correct. But I am curious why the PowerShell cmdlet "Get-SPOSite" returns that site and it has the attribute "LastContentModifiedDate: 03.09.2020 22:22:45" which is not correct. Do you know what these attributes precisely mean? – Максим Родин Sep 04 '20 at 07:04

1 Answers1

0

You can try using the 'id' that you have got from the search query and try to use that site id in the following query. https://graph.microsoft.com/v1.0/sites{siteid} You can get the right lastModifiedDateTime as shown below.

enter image description here

Please go through this document.

Shiva Keshav Varma
  • 3,398
  • 2
  • 9
  • 13