
If you have a script, an app or a Power Automate flow that calls /me/drive/sharedWithMe or /me/drive/recent, it’s on borrowed time. Microsoft Learn says both stay in a degraded state until November 2026 and then stop returning data. This post covers what’s going, how I find old calls in my own scripts, and what I’m moving them to.
What is being retired
Four Microsoft Graph endpoints stop returning data after November 2026:
| Endpoint | What it returned | Learn page |
|---|---|---|
/me/drive/sharedWithMe | Files and folders shared with the user | drive: sharedWithMe |
/me/drive/recent | Files the user opened or changed recently | drive: recent |
/me/insights/shared | Documents shared with the user | List shared |
/me/insights/used | Documents the user viewed or changed | List used |
The deprecation itself isn’t new. The Graph changelog recorded recent and sharedWithMe as deprecated in November 2025. What’s new is the cut-off.
The word “degraded” matters. Before an endpoint stops completely, it can return fewer items than the user sees in OneDrive. If a report’s numbers dropped in the last few months and nobody touched the script, this could be why.
Finding old calls in your scripts
I keep my scripts in one folder, so a text search finds them quickly. My function Find-MttDeprecatedGraphEndpoint does that search. Download it from my GitHub, load it and run it:
. .\Find-MttDeprecatedGraphEndpoint.ps1
Find-MttDeprecatedGraphEndpoint -Path C:\Scripts | Export-Csv .\GraphEndpoints.csv -NoTypeInformation -Encoding UTF8
The .json files cover exported Power Automate flows and SPFx config. Flows that call Graph through an HTTP action don’t live in a folder, so check those in the flow itself.
I ran it against my own C:\Workfolder folder, where I keep my blog scripts, leaving out the folder with this post’s own scripts, which contain the endpoint names on purpose:
PS> Find-MttDeprecatedGraphEndpoint -Path C:\Workfolder -Exclude 'C:\Workfolder\MSTechTalk Content\Nov-2026-posts'
PS>
Nothing returned is the result you want. If you get rows, each one shows the file, the line number, the retired endpoints on that line and the line itself. Group-Object Endpoint gives you a count per endpoint.
What to use instead
I haven’t found a documented one-to-one replacement on Microsoft Learn. The Microsoft Q&A threads on this end the same way: use the Microsoft Search API for file discovery, and accept that it behaves differently. That’s what I’m doing.
The Search API returns the files the signed-in user can access, trimmed by permissions. It doesn’t know what someone shared with you or what you opened last. You build that from a query and a sort order. For a recent files view, I query documents and sort by last modified date.
My function Get-MttRecentDocument runs this query with Microsoft Graph PowerShell (Microsoft.Graph.Authentication module) and delegated Files.Read.All and Sites.Read.All. Sign in, load it and run it:
Connect-MgGraph -Scopes Files.Read.All, Sites.Read.All
. .\Get-MttRecentDocument.ps1
Get-MttRecentDocument -Top 25 | Export-Csv .\RecentDocuments.csv -NoTypeInformation -Encoding UTF8
-Top goes past the 500-result page limit by paging, and -Query narrows the search with KQL, for example filetype:xlsx.
Run it as an ordinary user, not as admin, if you want to see what a user really sees. An admin account gets results from every site it can open.
Here are the first five of the 25 results on my demo tenant, signed in as my admin account, with Select-Object Name, LastModified, LastModifiedBy:
Name LastModified LastModifiedBy
---- ------------ --------------
Benefits Tracker Template - Small Projects.xlsx 11/14/2026 3:33:27 PM Olivia Bennett
Benefits Tracker Template - Major Projects.xlsx 11/14/2026 3:33:27 PM Olivia Bennett
Final Account Template - Major Projects.xlsx 11/14/2026 3:33:27 PM Olivia Bennett
Benefits Tracker Template.xlsx 11/14/2026 3:33:27 PM Olivia Bennett
Final Account Template - Small Projects.xlsx 11/14/2026 3:33:27 PM Olivia Bennett
Two things I noticed. The sort on lastModifiedDateTime worked on v1.0. And the WAM warning is real: if you run this from VS Code’s terminal, the sign-in window can open behind it, and the script looks stuck. All 25 results were Excel templates from the MST-PMO Templates library, because those were the files changed most recently on the sites my account can open.
Both functions and a README are on my GitHub: Graph-SharedWithMe-Retirement.
What you lose: items shared with you from another tenant (sharedWithMe had ?allowexternal=true for that), and the detail of who shared an item and when. If your app needs those, add your voice to the feedback item linked from the Q&A threads, because there’s nothing documented to move to yet.
Try it yourself
- Download both functions from GitHub.
Find-MttDeprecatedGraphEndpointneeds no module;Get-MttRecentDocumentneeds Microsoft.Graph.Authentication. - Run
Find-MttDeprecatedGraphEndpointon the folders where you keep scripts and exported flows, and fix every file it lists. - Sign in with
Connect-MgGraphas an ordinary user, runGet-MttRecentDocument, and compare the list with that user’s Recent view in OneDrive. - Try
-Querywithfiletype:docxor a sitepath:to see how far KQL gets you towards the view your app needs.







No Comments