How to retrieve share history for a DriveItem using Microsoft Graph API

TANG, ZIFENG (GARY) 0 Reputation points
2025-03-12T19:16:59.5966667+00:00

How can the Microsoft Graph API be used to retrieve sharing activities for a file or drive?

The endpoint /drives/{drive-id}/items/{item-id}/activities has been utilized to get a list of activities, but what is the date range for this endpoint? Although it returns necessary data, it does not seem to provide the complete activity list. Considering that this feature is in preview, is there a query parameter available to retrieve more than just recent activities? What does the recent activities represent in the documentation? 3/6/9 months?

Additionally, while the permissions endpoint returns a list of individuals who have access to the file, it does not include the share date or the permission granted date. Is there a method to track when the permission was granted or when the file was shared?

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

1 answer

Sort by: Most helpful
  1. Vasil Michev 115.3K Reputation points MVP
    2025-03-13T07:54:49.9666667+00:00

    The best way to get such data is via the audit log, which you can query via the /beta/security/auditLog/queries endpoint: https://learn.microsoft.com/en-us/graph/api/security-auditcoreroot-post-auditlogqueries?view=graph-rest-beta&tabs=http

    You can scope the query to include just sharePointSharingOperation events, and optionally scope it to a site/item. Keep in mind that the query is done asynchronously and you have to retrieve the results with additional call after it completes.

    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.