How to Patch Update OneDrive file's lastAccessedDateTime

cj256 1 Reputation point
2022-12-06T20:54:56.877+00:00

I would like to update an item's "lastAccessedDateTime" to current time
such that subsequent call to /recent will reflect that the file was recently accessed.

via the explorer:
I first send this query to Patch metadata
https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{driveItem-id}
(fill in drive-id + driveItm-id as appropriate)
with this request body (change timestamp to current time as appropriate)

   {  
       "fileSystemInfo": {  
           "lastAccessedDateTime": "2022-12-06T18:55:21.424Z",  
           "lastModifiedDateTime": "2022-12-06T18:55:21.424Z"  
       }  
   }  

Then on my subsequent call to
https://graph.microsoft.com/v1.0/me/drive/recent
I am expecting that item's "lastAccessedDateTime" to be updated, however it is not.

Any idea what I am missing here?
Thanks

Relevant docs that I have reviewed:

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,669 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Gopinath Chennamadhavuni 2,431 Reputation points
    2022-12-07T05:33:01.673+00:00

    Hi @cj256 ,

    Thanks for reaching out.

    As per the documentation, the property lastAccessedDateTime of fileSystemInfo is not available for items in SharePoint online or OneDrive for Business. So, we can't update this property using Graph API.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.


  2. Zehui Yao_MSFT 5,831 Reputation points
    2022-12-12T10:36:56.173+00:00

    Hi @cj256 , you can choose to open a support ticket to get help from a backend engineer.

    0 comments No comments