lastModifiedTime is incorrect when searching listitem with Microsoft Graph

Olga Andreeva 126 Reputation points
2022-12-12T17:06:50.63+00:00

Hello!

I am implementing the logic for searching listitems in SharePoint via Microsoft Graph, my request looks the following way:

POST https://graph.microsoft.com/v1.0/search/query     
  
 {  
       "requests":[  
          {  
             "entityTypes":[  
                "listItem"  
             ],  
             "query":{  
                "queryString":"path:\"path\" AND isDocument=true AND (NOT contenttype:\"application/onenote\n\nDocument\")"  
             },  
             "fields":[  
                "filename",  
                "listId",  
                "listItemId",  
                "createdBy",  
                "createdDateTime",  
                "lastModifiedDateTime"  
             ]  
          }  
       ]  
    }  

And the result looks like this:

{  
       "value":[  
          {  
             "searchTerms":[],  
             "hitsContainers":[  
                {  
                   "hits":[  
                      {  
                         "hitId":"hitId",  
                         "rank":1,  
                         "summary":"",  
                         "resource":{  
                            "@odata.type":"#microsoft.graph.listItem",  
                            "fields":{  
                               "filename":"Document.docx",  
                               "listId":"listId",  
                               "listItemId":"listItemId",  
                               "createdBy":"name"  
                            },  
                            "createdBy":{  
                               "user":{  
                                  "displayName":"name",  
                                  "email":"email"  
                               }  
                            },  
                            "createdDateTime":"2022-12-07T09:42:59Z",  
                            "lastModifiedDateTime":"2022-11-02T11:10:00Z"  
                         }  
                      }  
                   ],  
                   "total":1,  
                   "moreResultsAvailable":false  
                }  
             ]  
          }  
       ]  
    }  

As seen from the response the lastModifiedDateTime is incorrect as far as it is even earlier than createdDateTime.

Moreover, when I fetch this item from SharePoint with the following query:

GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/listId/items/listItemId  

I get the following correct result:

{  
   …  
   "createdDateTime":"2022-12-07T09:42:59Z",  
   "lastModifiedDateTime":"2022-12-07T09:43:01Z"  
}  

Could someone help me with this so that in listitem the modified date is correct.

Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
{count} votes

Answer accepted by question author
  1. RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
    2022-12-13T07:48:47.833+00:00

    Hi @Olga Andreeva
    Per my test, I can reproduce your issue like following, and I found that only .docx file will occur such error the file and the other type of will return the correct date.
    269936-image.png

    I would recommend you to raise a support case with Microsoft Graph, a Support Engineer will be able to assist you better. You can raise support ticket from
    http://aad.portal.azure.com/ or https://admin.microsoft.com/#/support/requests.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.