need to fetch last accessed details of a file using the graph api

Ashish Khandelwal 0 Reputation points
2024-11-19T08:13:39.5566667+00:00

Currently i am trying to fetch the audit logs of the one drive to see if any app has accessed my file hosted on ondrive using the graph api /auditLogs/directoryaudits. But the response is empty. Is there any endpoint that needs to accessed to fetch the same? I am able to download the results from the https://compliance.microsoft.com/ but i wanted to access the same using api.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,372 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
1,164 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 42,766 Reputation points
    2024-11-19T10:19:48.1166667+00:00

    Hi @Ashish Khandelwal

    If you want to get activity reports for OneDrive, you can try calling this endpoint:

    GET /reports/getOneDriveActivityUserDetail(period='D7')
    

    Source: https://learn.microsoft.com/en-us/graph/api/reportroot-getonedriveactivityuserdetail?view=graph-rest-1.0&tabs=http.

    Hope this helps.

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

    0 comments No comments

Your answer

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