There is, you can query the /permissions facet on each file/folder. Here's a sample script I wrote a while back: https://practical365.com/reporting-on-onedrive-for-business-shared-files/
The above is using the Graph API, you can of course use CSOM or the PowerShell PnP module as alternative.
There's also a built-in report you can generate via the UI: https://learn.microsoft.com/en-us/sharepoint/sharing-reports
In SharePoint and OneDrive, is there any API that can get a list of files/folders shared with external users and expiry dates when external users' access will expire?
Hi there
In SharePoint and OneDrive, is there any API that can get a list of files/folders shared with external users and expiry dates when external users' access will expire?
Thank you.
2 answers
Sort by: Most helpful
-
Vasil Michev 100.2K Reputation points MVP
2022-07-13T05:42:57.543+00:00 -
RaytheonXie_MSFT 33,641 Reputation points Microsoft Vendor
2022-07-13T07:00:56.35+00:00 Hi @frob ,
You can create a sharelink by following graph apiPOST /drives/{driveId}/items/{itemId}/createLink POST /groups/{groupId}/drive/items/{itemId}/createLink POST /me/drive/items/{itemId}/createLink POST /sites/{siteId}/drive/items/{itemId}/createLink POST /users/{userId}/drive/items/{itemId}/createLink
https://learn.microsoft.com/en-us/graph/api/driveitem-createlink?view=graph-rest-1.0&tabs=http
You can also grant permissions by following url
POST /shares/{encoded-sharing-url}/permission/grant
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.